Implement Vector4::Equals
This commit is contained in:
@@ -49,6 +49,9 @@ namespace J3ML::LinearAlgebra {
|
||||
bool operator==(const Vector4& rhs) const;
|
||||
bool operator!=(const Vector4& rhs) const;
|
||||
|
||||
bool Equals(const Vector4& rhs, float epsilon = 1e-3f) const;
|
||||
bool Equals(float _x, float _y, float _z, float _w, float epsilon = 1e-3f) const;
|
||||
|
||||
Vector4 Min(const Vector4& min) const;
|
||||
Vector4 Max(const Vector4& max) const;
|
||||
Vector4 Clamp(const Vector4& min, const Vector4& max) const;
|
||||
|
@@ -150,6 +150,20 @@ Vector4 Vector4::operator-(const Vector4& rhs) const
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool Vector4::Equals(const Vector4 &rhs, float epsilon) const {
|
||||
return std::abs(x - rhs.x) < epsilon &&
|
||||
std::abs(y - rhs.y) < epsilon &&
|
||||
std::abs(z - rhs.z) < epsilon &&
|
||||
std::abs(w - rhs.w) < epsilon;
|
||||
}
|
||||
|
||||
bool Vector4::Equals(float _x, float _y, float _z, float _w, float epsilon) const {
|
||||
return std::abs(x - _x) < epsilon &&
|
||||
std::abs(y - _y) < epsilon &&
|
||||
std::abs(z - _z) < epsilon &&
|
||||
std::abs(w - _w) < epsilon;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#pragma endregion
|
Reference in New Issue
Block a user