NumCpp  2.18.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
LLA.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <iostream>
31
32#include "NumCpp/NdArray.hpp"
34
36{
40 class LLA
41 {
42 public:
43 double latitude{ 0. }; // radians
44 double longitude{ 0. }; // radians
45 double altitude{ 0. }; // meters
46
50 LLA() = default;
51
58 // NOTLINTNEXTLINE(bugprone-easily-swappable-parameters)
59 constexpr LLA(double inLatitude, double inLongitude, double inAltitude = 0.) noexcept :
60 latitude(inLatitude),
61 longitude(inLongitude),
62 altitude(inAltitude)
63 {
64 }
65
70 [[nodiscard]] NdArray<double> toNdArray() const
71 {
72 NdArray<double> returnArray = { latitude, longitude, altitude };
73 return returnArray.transpose();
74 }
75
82 bool operator==(const LLA& other) const noexcept
83 {
84 return utils::essentiallyEqual(latitude, other.latitude) &&
85 utils::essentiallyEqual(longitude, other.longitude) &&
86 utils::essentiallyEqual(altitude, other.altitude);
87 }
88
95 bool operator!=(const LLA& other) const noexcept
96 {
97 return !(*this == other);
98 }
99 };
100
107 inline std::ostream& operator<<(std::ostream& os, const LLA& point)
108 {
109 os << "LLA(latitude=" << point.latitude << ", longitude=" << point.longitude << ", altitude=" << point.altitude
110 << ")\n";
111 return os;
112 }
113} // namespace nc::coordinates::reference_frames
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:135
self_type transpose() const
Definition NdArrayCore.hpp:4959
Geodetic coordinates.
Definition LLA.hpp:41
double longitude
Definition LLA.hpp:44
constexpr LLA(double inLatitude, double inLongitude, double inAltitude=0.) noexcept
Constructor.
Definition LLA.hpp:59
bool operator!=(const LLA &other) const noexcept
Non-Equality Operator.
Definition LLA.hpp:95
double altitude
Definition LLA.hpp:45
double latitude
Definition LLA.hpp:43
NdArray< double > toNdArray() const
Convert to NdArray.
Definition LLA.hpp:70
LLA()=default
Default Constructor.
bool operator==(const LLA &other) const noexcept
Non-Equality Operator.
Definition LLA.hpp:82
std::ostream & operator<<(std::ostream &os, const AER &point)
Stream operator.
Definition AER.hpp:108
bool essentiallyEqual(dtype inValue1, dtype inValue2) noexcept
Definition essentiallyEqual.hpp:47