NumCpp  2.18.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
Euler.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <iostream>
31
32#include "NumCpp/NdArray.hpp"
34
35namespace nc::coordinates
36{
40 class Euler
41 {
42 public:
43 double psi{ 0. };
44 double theta{ 0. };
45 double phi{ 0. };
46
50 Euler() noexcept = default;
51
59 constexpr Euler(double inPsi, double inTheta, double inPhi) noexcept :
60 psi(inPsi),
61 theta(inTheta),
62 phi(inPhi)
63 {
64 }
65
71 Euler(const Euler& other) noexcept = default;
72
78 Euler(Euler&& other) noexcept = default;
79
83 virtual ~Euler() = default;
84
89 [[nodiscard]] NdArray<double> toNdArray() const
90 {
91 NdArray<double> returnArray = { psi, theta, phi };
92 return returnArray.transpose();
93 }
94
100 Euler& operator=(const Euler& other) noexcept = default;
101
107 Euler& operator=(Euler&& other) noexcept = default;
108
115 bool operator==(const Euler& other) const noexcept
116 {
117 return utils::essentiallyEqual(psi, other.psi) && utils::essentiallyEqual(theta, other.theta) &&
118 utils::essentiallyEqual(phi, other.phi);
119 }
120
127 bool operator!=(const Euler& other) const noexcept
128 {
129 return !(*this == other);
130 }
131 };
132
139 inline std::ostream& operator<<(std::ostream& os, const Euler& Euler)
140 {
141 os << "Euler(psi=" << Euler.psi << ", theta=" << Euler.theta << ", phi=" << Euler.phi << ")\n";
142 return os;
143 }
144} // namespace nc::coordinates
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
Euler.
Definition Euler.hpp:41
double phi
Definition Euler.hpp:45
bool operator==(const Euler &other) const noexcept
Non-Equality Operator.
Definition Euler.hpp:115
virtual ~Euler()=default
Destructor.
bool operator!=(const Euler &other) const noexcept
Non-Equality Operator.
Definition Euler.hpp:127
Euler() noexcept=default
Default Constructor.
Euler & operator=(Euler &&other) noexcept=default
Move Assignement Operator.
Euler(const Euler &other) noexcept=default
Copy Constructor.
double psi
Definition Euler.hpp:43
NdArray< double > toNdArray() const
Convert to NdArray.
Definition Euler.hpp:89
Euler(Euler &&other) noexcept=default
Move Euler.
double theta
Definition Euler.hpp:44
Euler & operator=(const Euler &other) noexcept=default
Copy Assignement Operator.
Definition Cartesian.hpp:39
std::ostream & operator<<(std::ostream &os, const Cartesian &vec)
Stream operator.
Definition Cartesian.hpp:296
bool essentiallyEqual(dtype inValue1, dtype inValue2) noexcept
Definition essentiallyEqual.hpp:47