Implement Vector2 Less-Than and Greater-Than operators
This commit is contained in:
@@ -121,6 +121,8 @@ namespace J3ML::LinearAlgebra {
|
||||
|
||||
bool operator == (const Vector2& rhs) const;
|
||||
bool operator != (const Vector2& rhs) const;
|
||||
bool operator > (const Vector2& rhs) const;
|
||||
bool operator < (const Vector2& rhs) const;
|
||||
|
||||
/// Returns an element-wise minimum between two vectors.
|
||||
[[nodiscard]] Vector2 Min(const Vector2& min) const;
|
||||
|
@@ -499,6 +499,14 @@ namespace J3ML::LinearAlgebra {
|
||||
return std::format("{},{}", x, y);
|
||||
}
|
||||
|
||||
bool Vector2::operator>(const Vector2 &rhs) const {
|
||||
return this->Magnitude() > rhs.Magnitude();
|
||||
}
|
||||
|
||||
bool Vector2::operator<(const Vector2 &rhs) const {
|
||||
return this->Magnitude() < rhs.Magnitude();
|
||||
}
|
||||
|
||||
Vector2 operator*(float lhs, const Vector2 &rhs) {
|
||||
return {lhs * rhs.x, lhs * rhs.y};
|
||||
}
|
||||
|
Reference in New Issue
Block a user