Loading...
Searching...
No Matches
GeographicLib::Triaxial::Geodesic3 Class Reference

The solution of the geodesic problem for a triaxial ellipsoid. More...

`#include <GeographicLib/Triaxial/Geodesic3.hpp>`

## Public Member Functions

| Geodesic3 (const Ellipsoid3 &t=Ellipsoid3{})
| Geodesic3 (real a, real b, real c)
| Geodesic3 (real b, real e2, real k2, real kp2)
const Ellipsoid3 & | t () const
GeodesicLine3 | Inverse (Angle bet1, Angle omg1, Angle bet2, Angle omg2, real &s12, Angle &alp1, Angle &alp2) const
GeodesicLine3 | Inverse (real bet1, real omg1, real bet2, real omg2, real &s12, real &alp1, real &alp2) const
GeodesicLine3 | Direct (Angle bet1, Angle omg1, Angle alp1, real s12, Angle &bet2, Angle &omg2, Angle &alp2) const
GeodesicLine3 | Direct (real bet1, real omg1, real alp1, real s12, real &bet2, real &omg2, real &alp2) const
GeodesicLine3 | Line (Angle bet1, Angle omg1, Angle alp1) const
GeodesicLine3 | Line (real bet1, real omg1, real alp1) const
void | umbalt (bool numbalt)
bool | umbalt () const

## Detailed Description

The solution of the geodesic problem for a triaxial ellipsoid.

This is an implementation of Jacobi's method for finding geodesics on a triaxial ellipsoid (1839). This class offers an interface to the solutions to the direct geodesic problem via the GeodesicLine3 class which contains the meat of Jacobi's direct solution. In addition it provides a solution to the inverse problem which closely parallels the solution for the biaxial problem given by GeodesicExact. For more details see Geodesics on a triaxial ellipsoid and

- C. F. F. Karney,
  Jacobi's solution for geodesics on a triaxial ellipsoid,
  Technical Report, SRI International, Nov. 2025.
  arxiv:2511.01621

Data for testing the geodesic routines is available at Test set of geodesics on a triaxial ellipsoid (2024).

Note
  There's a lot of new code here and testing is two orders of magnitude more difficult compared with the biaxial case (an extra parameter to fix the shape of the ellipsoid and geodesics now depend on the longitude of the two end points separately). I've limited by testing to ellipsoids with a/c ≤ 2. I don't expect any problems if a/c ≤ 10; but you might run into problems with more eccentric ellipsoids. The code treats oblate and prolate (biaxial) ellipsoids correctly; but, again, there may be problems with triaxial ellipsoids which are extremely close to oblate or prolate i.e., with either k or k' very small. (However the triaxial model of the Earth where the difference in the equatorial semiaxes is 70 m, \(k' = 0.057\), is treated just fine.) While I have made every effort to ensure that the code is error free, it's likely that some bugs remain. Please use caution with the results and report any problems (via email or with a Github issue).

Example of use:

// Example of using the Triaxial::Geodesic3 class.
#include <iostream>
#include <iomanip>
#include <exception>
#include <GeographicLib/Triaxial/Geodesic3.hpp>
using namespace std;
using namespace GeographicLib;
int main() {
try {
Triaxial::Geodesic3 g(Triaxial::Ellipsoid3::Earth());
double bet1 = 10, omg1 = 30, bet2 = 80, omg2 = -50,
alp1, alp2, s12;
g.Inverse(bet1, omg1, bet2, omg2, s12, alp1, alp2);
cout << "geodesic between [" << bet1 << "," << omg1 << "] and ["
<< bet2 << "," << omg2 << "]\n";
cout << fixed << setprecision(3)
<< "s12 = " << s12 << ", alp1 = "
<< alp1 << ", alp2 = " << alp2 << "\n";
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}
main
int main(int argc, const char *const argv[])
Definition Cart3Convert.cpp:52
Geodesic3.hpp
Header for GeographicLib::Triaxial::Geodesic3 class.
GeographicLib::Triaxial::Ellipsoid3::Earth
static const Ellipsoid3 & Earth()
Definition Ellipsoid3.cpp:226
GeographicLib::Triaxial::Geodesic3
The solution of the geodesic problem for a triaxial ellipsoid.
Definition Geodesic3.hpp:71
GeographicLib
Namespace for GeographicLib.
Definition Accumulator.cpp:12
std
Definition NearestNeighbor.hpp:806

Geod3Solve is a command-line utility providing access to the functionality of Geodesic3 and GeodesicLine3.

Definition at line 71 of file Geodesic3.hpp.

## Constructor & Destructor Documentation

## Geodesic3() [1/3]

GeographicLib::Triaxial::Geodesic3::Geodesic3 | ( | const Ellipsoid3 & | t = Ellipsoid3{} | ) |

Constructor for a triaxial ellipsoid defined by Ellipsoid3 object.

Parameters

  [in] | t | the Ellipsoid3 object.

Definition at line 19 of file Geodesic3.cpp.

References t().

Referenced by Geodesic3(), and Geodesic3().

## Geodesic3() [2/3]

GeographicLib::Triaxial::Geodesic3::Geodesic3 | ( | real | a,
|  | real | b,
|  | real | c )

Constructor for a triaxial ellipsoid with semiaxes.

Parameters

  [in] | a | the largest semiaxis.
  [in] | b | the middle semiaxis.
  [in] | c | the smallest semiaxis.

Exceptions

  GeographicErr | if the required ordering is semiaxes is violated.

The semiaxes must satisfy a ≥ b ≥ c > 0. If a = c (a sphere), then the oblate limit is taken.

Definition at line 25 of file Geodesic3.cpp.

References Geodesic3().

## Geodesic3() [3/3]

GeographicLib::Triaxial::Geodesic3::Geodesic3 | ( | real | b,
|  | real | e2,
|  | real | k2,
|  | real | kp2 )

Alternate constructor for a triaxial ellipsoid.

Parameters

  [in] | b | the middle semiaxis.
  [in] | e2 | the eccentricity squared \(e^2 = (a^2 - c^2)/b^2\).
  [in] | k2 | the oblateness parameter squared \(k^2 = (b^2 - c^2) / (a^2 - c^2)\).
  [in] | kp2 | the prolateness parameter squared \(k'^2= (a^2 - b^2) / (a^2 - c^2)\).

Exceptions

  GeographicErr | if the required ordering is semiaxes is violated.

Note
  The constructor normalizes k2 and kp2 to ensure then k2 + kp2 = 1.

Definition at line 29 of file Geodesic3.cpp.

References Geodesic3().

## Member Function Documentation

## t()

const Ellipsoid3 & GeographicLib::Triaxial::Geodesic3::t | ( |  | ) | const

inline

Returns
  the Ellipsoid3 object for this projection.

Definition at line 193 of file Geodesic3.hpp.

Referenced by Geodesic3(), and Inverse().

## Inverse() [1/2]

GeodesicLine3 GeographicLib::Triaxial::Geodesic3::Inverse | ( | Angle | bet1,
|  | Angle | omg1,
|  | Angle | bet2,
|  | Angle | omg2,
|  | real & | s12,
|  | Angle & | alp1,
|  | Angle & | alp2 ) const

Solve the inverse problem

Parameters

  [in] | bet1 | the ellipsoidal latitude of point 1.
  [in] | omg1 | the ellipsoidal longitude of point 1.
  [in] | bet2 | the ellipsoidal latitude of point 2.
  [in] | omg2 | the ellipsoidal longitude of point 2.
  [out] | s12 | the shortest distance between the points.
  [out] | alp1 | the forward azimuth of the geodesic at point 1.
  [out] | alp2 | the forward azimuth of the geodesic at point 2.

Returns
  a GeodesicLine3 object defining the geodesic.

Definition at line 34 of file Geodesic3.cpp.

References GeographicLib::Triaxial::Ellipsoid3::AngNorm(), GeographicLib::AngleT< T >::base(), GeographicLib::AngleT< T >::c(), GeographicLib::AngleT< Math::real >::cardinal(), GeographicLib::AngleT< Math::real >::eps(), GeographicLib::AngleT< T >::flipsign(), GeographicLib::Math::NaN(), GeographicLib::Math::pi(), GeographicLib::AngleT< T >::radians(), GeographicLib::AngleT< Math::real >::radians(), GeographicLib::AngleT< T >::radians0(), GeographicLib::AngleT< T >::reflect(), GeographicLib::AngleT< T >::round(), GeographicLib::AngleT< T >::s(), GeographicLib::AngleT< T >::setn(), GeographicLib::AngleT< T >::setquadrant(), GeographicLib::Math::sq(), std::swap(), and t().

Referenced by Inverse().

## Inverse() [2/2]

GeodesicLine3 GeographicLib::Triaxial::Geodesic3::Inverse | ( | real | bet1,
|  | real | omg1,
|  | real | bet2,
|  | real | omg2,
|  | real & | s12,
|  | real & | alp1,
|  | real & | alp2 ) const

Solve the inverse problem in degrees

Parameters

  [in] | bet1 | the ellipsoidal latitude of point 1 (in degrees).
  [in] | omg1 | the ellipsoidal longitude of point 1 (in degrees).
  [in] | bet2 | the ellipsoidal latitude of point 2 (in degrees).
  [in] | omg2 | the ellipsoidal longitude of point 2 (in degrees).
  [out] | s12 | the shortest distance between the points.
  [out] | alp1 | the forward azimuth of the geodesic at point 1 (in degrees).
  [out] | alp2 | the forward azimuth of the geodesic at point 2 (in degrees).

Returns
  a GeodesicLine3 object defining the geodesic.

Definition at line 924 of file Geodesic3.cpp.

References Inverse().

## Direct() [1/2]

GeodesicLine3 GeographicLib::Triaxial::Geodesic3::Direct | ( | Angle | bet1,
|  | Angle | omg1,
|  | Angle | alp1,
|  | real | s12,
|  | Angle & | bet2,
|  | Angle & | omg2,
|  | Angle & | alp2 ) const

Solve the direct problem

Parameters

  [in] | bet1 | the ellipsoidal latitude of point 1.
  [in] | omg1 | the ellipsoidal longitude of point 1.
  [in] | alp1 | the forward azimuth of the geodesic at point 1.
  [in] | s12 | the distance from point 1 to point 2.
  [out] | bet2 | the ellipsoidal latitude of point 2.
  [out] | omg2 | the ellipsoidal longitude of point 2.
  [out] | alp2 | the forward azimuth of the geodesic at point 2.

Returns
  a GeodesicLine3 object defining the geodesic.

Definition at line 916 of file Geodesic3.cpp.

References GeographicLib::Triaxial::GeodesicLine3::Position().

Referenced by Direct().

## Direct() [2/2]

GeodesicLine3 GeographicLib::Triaxial::Geodesic3::Direct | ( | real | bet1,
|  | real | omg1,
|  | real | alp1,
|  | real | s12,
|  | real & | bet2,
|  | real & | omg2,
|  | real & | alp2 ) const

Solve the direct problem in degrees

Parameters

  [in] | bet1 | the ellipsoidal latitude of point 1 (in degrees).
  [in] | omg1 | the ellipsoidal longitude of point 1 (in degrees).
  [in] | alp1 | the forward azimuth of the geodesic at point 1 (in degrees).
  [in] | s12 | the distance from point 1 to point 2.
  [out] | bet2 | the ellipsoidal latitude of point 2 (in degrees).
  [out] | omg2 | the ellipsoidal longitude of point 2 (in degrees).
  [out] | alp2 | the forward azimuth of the geodesic at point 2 (in degrees).

Returns
  a GeodesicLine3 object defining the geodesic.

Definition at line 937 of file Geodesic3.cpp.

References Direct().

## Line() [1/2]

GeodesicLine3 GeographicLib::Triaxial::Geodesic3::Line | ( | Angle | bet1,
|  | Angle | omg1,
|  | Angle | alp1 ) const

A geodesic line defined at a starting point

Parameters

  [in] | bet1 | the ellipsoidal latitude of point 1.
  [in] | omg1 | the ellipsoidal longitude of point 1.
  [in] | alp1 | the forward azimuth of the geodesic at point 1.

Returns
  a GeodesicLine3 object defining the geodesic.

Definition at line 912 of file Geodesic3.cpp.

Referenced by Line().

## Line() [2/2]

GeodesicLine3 GeographicLib::Triaxial::Geodesic3::Line | ( | real | bet1,
|  | real | omg1,
|  | real | alp1 ) const

A geodesic line defined at a starting point specified in degrees

Parameters

  [in] | bet1 | the ellipsoidal latitude of point 1 (in degrees).
  [in] | omg1 | the ellipsoidal longitude of point 1 (in degrees).
  [in] | alp1 | the forward azimuth of the geodesic at point 1 (in degrees).

Returns
  a GeodesicLine3 object defining the geodesic.

Definition at line 933 of file Geodesic3.cpp.

References Line().

## umbalt() [1/2]

void GeographicLib::Triaxial::Geodesic3::umbalt | ( | bool | numbalt | ) |

inline

Specify the behavior of umbilical geodesics

Parameters

  [in] | numbalt | the new value of the umbalt flag.

If umbalt is true (resp. false) then the latitude (resp. longitude) of an umbilical geodesic is the librating coordinate and the longitude (resp. latitude) is the rotating coordinate. This has no effect for biaxial ellipsoids. In this case the latitude (resp. longitude) is always the librating coordinate for oblate (resp. prolate) ellipsoids.

Definition at line 284 of file Geodesic3.hpp.

## umbalt() [2/2]

bool GeographicLib::Triaxial::Geodesic3::umbalt | ( |  | ) | const

inline

Returns
  the value of the umbalt flag; see umbalt(bool)).

Definition at line 290 of file Geodesic3.hpp.

The documentation for this class was generated from the following files:

- Geodesic3.hpp
- Geodesic3.cpp