63 constexpr
Cartesian(
double inX,
double inY,
double inZ = 0.) noexcept :
76 x(inCartesianVector.
x),
77 y(inCartesianVector.
y)
87 x(inCartesianVector.
x),
88 y(inCartesianVector.
y),
89 z(inCartesianVector.
z)
100 if (inCartesianVector.
size() != 3)
105 x = inCartesianVector[0];
106 y = inCartesianVector[1];
107 z = inCartesianVector[2];
150 return { 1., 0., 0. };
160 return { 0., 1., 0. };
170 return { 0., 0., 1. };
193 return !(*
this == other);
205 return { lhs.
x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z };
216 return { lhs.
x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z };
227 return lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z;
238 return { vec.x * scalar, vec.y * scalar, vec.z * scalar };
260 return vec * (1.0 / denominator);
271 os <<
"Cartesian(x=" << vec.
x <<
", y=" << vec.
y <<
", z=" << vec.
z <<
")\n";
284 return { vec1.
y * vec2.z - vec1.z * vec2.y,
285 -(vec1.x * vec2.z - vec1.z * vec2.x),
286 vec1.x * vec2.y - vec1.y * vec2.x };
308 return vec /
norm(vec);
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:37
size_type size() const noexcept
Definition: NdArrayCore.hpp:4524
Holds a 2D vector.
Definition: Vec2.hpp:49
Holds a 3D vector.
Definition: Vec3.hpp:51
Cartensian coordinates.
Definition: Cartesian.hpp:45
bool operator!=(const Cartesian &other) const noexcept
Non-Equality Operator.
Definition: Cartesian.hpp:191
Cartesian(const Vec3 &inCartesianVector)
Default Constructor.
Definition: Cartesian.hpp:86
bool operator==(const Cartesian &other) const noexcept
Non-Equality Operator.
Definition: Cartesian.hpp:179
virtual ~Cartesian()=default
Destructor.
static Cartesian zHat() noexcept
z Unit Vector
Definition: Cartesian.hpp:168
Cartesian & operator=(const Cartesian &other) noexcept=default
Copy Assignement Operator.
static Cartesian xHat() noexcept
x Unit Vector
Definition: Cartesian.hpp:148
Cartesian(const Cartesian &other) noexcept=default
Copy Constructor.
double z
Definition: Cartesian.hpp:49
Cartesian(const Vec2 &inCartesianVector)
Default Constructor.
Definition: Cartesian.hpp:75
Cartesian(Cartesian &&other) noexcept=default
Move Constructor.
static Cartesian yHat() noexcept
y Unit Vector
Definition: Cartesian.hpp:158
double y
Definition: Cartesian.hpp:48
Cartesian() noexcept=default
Default Constructor.
double x
Definition: Cartesian.hpp:47
Cartesian(const NdArray< double > &inCartesianVector)
Definition: Cartesian.hpp:98
Cartesian & operator=(Cartesian &&other) noexcept=default
Move Assignement Operator.
Definition: Cartesian.hpp:40
double norm(const Cartesian &vec) noexcept
Vector norm.
Definition: Cartesian.hpp:295
Cartesian cross(const Cartesian &vec1, const Cartesian &vec2) noexcept
Vector cross product.
Definition: Cartesian.hpp:282
std::ostream & operator<<(std::ostream &os, const Cartesian &vec)
Stream operator.
Definition: Cartesian.hpp:269
double angle(const Cartesian &vec1, const Cartesian &vec2) noexcept
angle between the two vectors
Definition: Cartesian.hpp:318
Cartesian operator+(const Cartesian &lhs, const Cartesian &rhs) noexcept
Addition of two cartesian points.
Definition: Cartesian.hpp:203
Cartesian normalize(const Cartesian &vec) noexcept
normalize the input vector
Definition: Cartesian.hpp:306
Cartesian operator-(const Cartesian &lhs, const Cartesian &rhs) noexcept
Subtraction of two cartesian points.
Definition: Cartesian.hpp:214
double operator*(const Cartesian &lhs, const Cartesian &rhs) noexcept
Dot product of two cartesian points.
Definition: Cartesian.hpp:225
Cartesian operator/(const Cartesian &vec, double denominator) noexcept
Scalar Division a cartesian point.
Definition: Cartesian.hpp:258
bool essentiallyEqual(dtype inValue1, dtype inValue2) noexcept
Definition: essentiallyEqual.hpp:49
double hypot(dtype inValue1, dtype inValue2) noexcept
Definition: hypot.hpp:56