NumCpp  2.11.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
geocentricToLLA.hpp
Go to the documentation of this file.
1 #pragma once
29 
30 #include <cmath>
31 
36 #include "NumCpp/Utils/sqr.hpp"
37 
39 {
46  [[nodiscard]] inline reference_frames::LLA geocentricToLLA(const reference_frames::Geocentric& point) noexcept
47  {
48  constexpr auto flatteningFactor =
51 
52  const auto geodeticLatitude = std::atan((1. / utils::sqr(1. - flatteningFactor)) * std::tan(point.latitude));
53  auto geodetic = reference_frames::LLA{ geodeticLatitude, point.longitude, 0. };
54  geodetic.altitude = point.radius - geocentricRadius(geodetic);
55  return geodetic;
56  }
57 } // namespace nc::coordinates::transforms
Geocentric coordinates.
Definition: Geocentric.hpp:40
Geodetic coordinates.
Definition: LLA.hpp:40
double longitude
Definition: LLA.hpp:43
constexpr double EARTH_POLAR_RADIUS
Definition: Coordinates/ReferenceFrames/Constants.hpp:33
constexpr double EARTH_EQUATORIAL_RADIUS
Definition: Coordinates/ReferenceFrames/Constants.hpp:34
Definition: AERtoECEF.hpp:38
double geocentricRadius(const reference_frames::LLA &point) noexcept
Returns the geocentric radius.
Definition: geocentricRadius.hpp:44
reference_frames::LLA geocentricToLLA(const reference_frames::Geocentric &point) noexcept
Converts from geocentric to geodetic.
Definition: geocentricToLLA.hpp:46
constexpr dtype sqr(dtype inValue) noexcept
Definition: sqr.hpp:42
auto tan(dtype inValue) noexcept
Definition: tan.hpp:49