NumCpp  2.18.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
Geocentric.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <iostream>
31
32#include "NumCpp/NdArray.hpp"
34
36{
41 {
42 public:
43 double latitude{ 0. }; // radians
44 double longitude{ 0. }; // radians
45 double radius{ 0. }; // meters
46
50 Geocentric() = default;
51
58 // NOTLINTNEXTLINE(bugprone-easily-swappable-parameters)
59 constexpr Geocentric(double inLatitude, double inLongitude, double inRadius = 0.) noexcept :
60 latitude(inLatitude),
61 longitude(inLongitude),
62 radius(inRadius)
63 {
64 }
65
70 [[nodiscard]] NdArray<double> toNdArray() const
71 {
72 NdArray<double> returnArray = { latitude, longitude, radius };
73 return returnArray.transpose();
74 }
75
82 bool operator==(const Geocentric& other) const noexcept
83 {
84 return utils::essentiallyEqual(latitude, other.latitude) &&
85 utils::essentiallyEqual(longitude, other.longitude) && utils::essentiallyEqual(radius, other.radius);
86 }
87
94 bool operator!=(const Geocentric& other) const noexcept
95 {
96 return !(*this == other);
97 }
98 };
99
106 inline std::ostream& operator<<(std::ostream& os, const Geocentric& point)
107 {
108 os << "Geocentric(latitude=" << point.latitude << ", longitude=" << point.longitude
109 << ", radius=" << point.radius << ")\n";
110 return os;
111 }
112} // 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
Geocentric coordinates.
Definition Geocentric.hpp:41
double latitude
Definition Geocentric.hpp:43
bool operator!=(const Geocentric &other) const noexcept
Non-Equality Operator.
Definition Geocentric.hpp:94
NdArray< double > toNdArray() const
Convert to NdArray.
Definition Geocentric.hpp:70
bool operator==(const Geocentric &other) const noexcept
Non-Equality Operator.
Definition Geocentric.hpp:82
double radius
Definition Geocentric.hpp:45
constexpr Geocentric(double inLatitude, double inLongitude, double inRadius=0.) noexcept
Constructor.
Definition Geocentric.hpp:59
Geocentric()=default
Default Constructor.
double longitude
Definition Geocentric.hpp:44
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