minor improvement

This commit is contained in:
2024-11-22 20:53:43 +03:00
parent 52624b013f
commit 17fe9ed1fd
7 changed files with 66 additions and 34 deletions

View File

@@ -16,7 +16,7 @@ namespace omath
float y = 0.f;
// Constructors
constexpr Vector2() : x(0.f), y(0.f) {}
constexpr Vector2() = default;
constexpr Vector2(const float x, const float y) : x(x), y(y) {}
@@ -66,7 +66,7 @@ namespace omath
return *this;
}
constexpr Vector2& operator*=(float fl)
constexpr Vector2& operator*=(const float fl)
{
x *= fl;
y *= fl;
@@ -74,7 +74,7 @@ namespace omath
return *this;
}
constexpr Vector2& operator/=(float fl)
constexpr Vector2& operator/=(const float fl)
{
x /= fl;
y /= fl;
@@ -82,7 +82,7 @@ namespace omath
return *this;
}
constexpr Vector2& operator+=(float fl)
constexpr Vector2& operator+=(const float fl)
{
x += fl;
y += fl;
@@ -90,7 +90,7 @@ namespace omath
return *this;
}
constexpr Vector2& operator-=(float fl)
constexpr Vector2& operator-=(const float fl)
{
x -= fl;
y -= fl;
@@ -177,12 +177,12 @@ namespace omath
return {x - v.x, y - v.y};
}
[[nodiscard]] constexpr Vector2 operator*(float fl) const
[[nodiscard]] constexpr Vector2 operator*(const float fl) const
{
return {x * fl, y * fl};
}
[[nodiscard]] constexpr Vector2 operator/(float fl) const
[[nodiscard]] constexpr Vector2 operator/(const float fl) const
{
return {x / fl, y / fl};
}