48 const double PI = 3.14159265358979323846 ;
49 const int itmax = 40 ;
50 const double epsilon = 1.0e-6 ;
53 double u, a2_b2, d, e, f, df, c, s, p, q ;
62 u = sqrt (coordCart[0] * coordCart[0] + coordCart[1] * coordCart[1]) ;
66 if (coordCart[2] >= 0.0)
67 coordGeod[1] =
PI / 2.0 ;
69 coordGeod[1] = -
PI / 2.0 ;
70 coordGeod[2] = fabs (coordCart[2]) - demiPtAxe ;
74 coordGeod[0] = atan2 (coordCart[1] , coordCart[0]) ;
75 a2_b2 = demiGdAxe * demiGdAxe - demiPtAxe * demiPtAxe ;
76 e = atan (coordCart[2] / u) ;
86 q = demiPtAxe * coordCart[2] ;
87 f = p * s - q * c - a2_b2 * s * c ;
88 df = p * c + q * s - a2_b2 * (c * c - s * s) ;
91 if ((d < epsilon) || (iter >= itmax))
94 coordGeod[1] = atan (tan (e) * demiGdAxe / demiPtAxe) ;
96 p = cos(coordGeod[1]) ;
98 if (fabs(coordGeod[1]) <= (
PI * 0.5))
99 coordGeod[2] = (u - demiGdAxe * cos(e)) / cos(coordGeod[1]) ;
101 coordGeod[2] = (coordCart[2] - demiPtAxe * sin(e)) / sin(coordGeod[1]) ;
void set_coordinates(double x, double y, double z)
This class represents a coordinate in a geodesic reference.
~RectangularCoordinate()
Destructor.
This class represents a coordinate.
This class represents a coordinate in a rectangular reference.
void AsGeodesicCoordinates(double demiGdAxe, double demiPtAxe, GeodesicCoordinate *geod)
RectangularCoordinate()
Constructor.
RectangularCoordinate & operator=(const RectangularCoordinate &rhs)
Affectation operator.