NumCpp  2.11.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
ECEFtoENU.hpp
Go to the documentation of this file.
1 #pragma once
29 
30 #include <cmath>
31 
37 
39 {
49  [[nodiscard]] inline reference_frames::ENU ECEFtoENU(const reference_frames::ECEF& target,
50  const reference_frames::LLA& referencePoint) noexcept
51  {
52  const auto sinLat = std::sin(referencePoint.latitude);
53  const auto cosLat = std::cos(referencePoint.latitude);
54  const auto sinLon = std::sin(referencePoint.longitude);
55  const auto cosLon = std::cos(referencePoint.longitude);
56 
57  const auto referencePointECEF = LLAtoECEF(referencePoint);
58 
59  const auto x = target.x - referencePointECEF.x;
60  const auto y = target.y - referencePointECEF.y;
61  const auto z = target.z - referencePointECEF.z;
62 
63  return { -sinLon * x + cosLon * y,
64  -sinLat * cosLon * x - sinLat * sinLon * y + cosLat * z,
65  cosLat * cosLon * x + cosLat * sinLon * y + sinLat * z };
66  }
67 
77  [[nodiscard]] inline reference_frames::ENU ECEFtoENU(const reference_frames::ECEF& target,
78  const reference_frames::ECEF& referencePoint) noexcept
79  {
80  return ECEFtoENU(target, ECEFtoLLA(referencePoint));
81  }
82 } // namespace nc::coordinates::transforms
ECEF coordinates.
Definition: ECEF.hpp:40
East North Up coordinates.
Definition: ENU.hpp:40
Geodetic coordinates.
Definition: LLA.hpp:40
Definition: AERtoECEF.hpp:38
reference_frames::ECEF LLAtoECEF(const reference_frames::LLA &point) noexcept
Converts the LLA coordinates to ECEF https://en.wikipedia.org/wiki/Geographic_coordinate_conversion#F...
Definition: LLAtoECEF.hpp:46
reference_frames::ENU ECEFtoENU(const reference_frames::ECEF &target, const reference_frames::LLA &referencePoint) noexcept
Converts the ECEF coordinates to ENU https://apps.dtic.mil/sti/pdfs/AD1170763.pdf Figure 11 https://a...
Definition: ECEFtoENU.hpp:49
reference_frames::LLA ECEFtoLLA(const reference_frames::ECEF &ecef, double tol=1e-8) noexcept
Converts ECEF coordinates to LLA https://en.wikipedia.org/wiki/Geographic_coordinate_conversion#From_...
Definition: ECEFtoLLA.hpp:49
auto sin(dtype inValue) noexcept
Definition: sin.hpp:49
auto cos(dtype inValue) noexcept
Definition: cos.hpp:49