51 constexpr int MAX_ITER = 10;
55 const auto p = std::hypot(ecef.
x, ecef.
y);
56 const auto lon = std::atan2(ecef.
y, ecef.
x);
73 while (err > tol && iter < MAX_ITER)
76 std::sqrt(1 - E_SQR *
utils::sqr(std::sin(lat)));
77 lat = std::atan((ecef.
z / p) / (1 - (N * E_SQR / (N + alt))));
78 double newAlt = (p / std::cos(lat)) - N;
79 err = std::abs(alt - newAlt);
84 return { lat, lon, alt };
double z
Definition Cartesian.hpp:49
double y
Definition Cartesian.hpp:48
double x
Definition Cartesian.hpp:47
ECEF coordinates.
Definition ECEF.hpp:40
Geodetic coordinates.
Definition LLA.hpp:40
constexpr double pi
Pi.
Definition Core/Constants.hpp:39
constexpr double EARTH_POLAR_RADIUS
Definition Coordinates/ReferenceFrames/Constants.hpp:33
constexpr double EARTH_EQUATORIAL_RADIUS
Definition Coordinates/ReferenceFrames/Constants.hpp:34
constexpr dtype sqr(dtype inValue) noexcept
Definition sqr.hpp:42
int8 sign(dtype inValue) noexcept
Definition sign.hpp:52