diff --git a/include/J3ML/LinearAlgebra/Vector3.h b/include/J3ML/LinearAlgebra/Vector3.h index d55f2ed..aaa8a31 100644 --- a/include/J3ML/LinearAlgebra/Vector3.h +++ b/include/J3ML/LinearAlgebra/Vector3.h @@ -29,6 +29,8 @@ public: static const Vector3 Forward; static const Vector3 Backward; static const Vector3 NaN; + static const Vector3 Infinity; + static const Vector3 NegativeInfinity; static void Orthonormalize(Vector3& a, Vector3& b) { @@ -37,6 +39,8 @@ public: b = b.Normalize(); } + Vector3 Abs() const; + /// Returns the DirectionVector for a given angle. static Vector3 Direction(const Vector3 &rhs) ; @@ -179,4 +183,9 @@ public: float y = 0; float z = 0; }; + + static Vector3 operator*(float lhs, const Vector3& rhs) + { + return rhs * lhs; + } } \ No newline at end of file diff --git a/src/J3ML/LinearAlgebra/Vector3.cpp b/src/J3ML/LinearAlgebra/Vector3.cpp index 295ce3c..9932514 100644 --- a/src/J3ML/LinearAlgebra/Vector3.cpp +++ b/src/J3ML/LinearAlgebra/Vector3.cpp @@ -15,6 +15,8 @@ namespace J3ML::LinearAlgebra { const Vector3 Vector3::Forward = {0, 0, -1}; const Vector3 Vector3::Backward = {0, 0, 1}; const Vector3 Vector3::NaN = {NAN, NAN, NAN}; + const Vector3 Vector3::Infinity = {INFINITY, INFINITY, INFINITY}; + const Vector3 Vector3::NegativeInfinity = {-INFINITY, -INFINITY, -INFINITY}; Vector3 Vector3::operator+(const Vector3& rhs) const { @@ -308,5 +310,9 @@ namespace J3ML::LinearAlgebra { return {x, y, z}; } + Vector3 Vector3::Abs() const { + return {std::abs(x), std::abs(y), std::abs(z)}; + } + } \ No newline at end of file