Add Vector2::PreciselyEquals(),

This commit is contained in:
2025-02-02 22:11:02 -05:00
parent 174f6068e7
commit 8e8a0a37d4

View File

@@ -513,6 +513,20 @@ namespace J3ML::LinearAlgebra {
y = rhs.y;
}
bool Vector2::Equals(const Vector2 &rhs, float epsilon) const {
return Math::EqualAbs(x, rhs.x, epsilon) &&
Math::EqualAbs(y, rhs.y, epsilon);
}
bool Vector2::Equals(float x_, float y_, float epsilon) const {
return Math::EqualAbs(x, x_, epsilon) &&
Math::EqualAbs(y, y_, epsilon);
}
bool Vector2::PreciselyEquals(const Vector2 &rhs) const {
return this->x == rhs.x && this->y == rhs.y;
}
Vector2 operator*(float lhs, const Vector2 &rhs) {
return {lhs * rhs.x, lhs * rhs.y};
}