Implement Vector3::Equals
This commit is contained in:
@@ -162,6 +162,10 @@ public:
|
|||||||
/// Unary - operator (Negation)
|
/// Unary - operator (Negation)
|
||||||
Vector3 operator-() const;
|
Vector3 operator-() const;
|
||||||
|
|
||||||
|
bool Equals(const Vector3& rhs, float epsilon = 1e-3f) const;
|
||||||
|
bool Equals(float _x, float _y, float _z, float epsilon = 1e-3f) const;
|
||||||
|
|
||||||
|
|
||||||
Vector3 &operator =(const Vector3& rhs);
|
Vector3 &operator =(const Vector3& rhs);
|
||||||
Vector3& operator+=(const Vector3& rhs);
|
Vector3& operator+=(const Vector3& rhs);
|
||||||
Vector3& operator-=(const Vector3& rhs);
|
Vector3& operator-=(const Vector3& rhs);
|
||||||
|
@@ -409,5 +409,17 @@ namespace J3ML::LinearAlgebra {
|
|||||||
return rhs.Abs();
|
return rhs.Abs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Vector3::Equals(const Vector3 &rhs, float epsilon) const {
|
||||||
|
return std::abs(x - rhs.x) < epsilon &&
|
||||||
|
std::abs(y - rhs.y) < epsilon &&
|
||||||
|
std::abs(z - rhs.z) < epsilon;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Vector3::Equals(float _x, float _y, float _z, float epsilon) const {
|
||||||
|
return std::abs(x - _x) < epsilon &&
|
||||||
|
std::abs(y - _y) < epsilon &&
|
||||||
|
std::abs(z - _z) < epsilon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user