diff --git a/Userland/Libraries/LibGfx/Vector2.h b/Userland/Libraries/LibGfx/Vector2.h index 2aa13136b28..43aa58df96d 100644 --- a/Userland/Libraries/LibGfx/Vector2.h +++ b/Userland/Libraries/LibGfx/Vector2.h @@ -50,6 +50,11 @@ public: return Vector2(m_x - other.m_x, m_y - other.m_y); } + constexpr Vector2 operator-() const + { + return Vector2(-m_x, -m_y); + } + constexpr Vector2 operator*(const Vector2& other) const { return Vector2(m_x * other.m_x, m_y * other.m_y); diff --git a/Userland/Libraries/LibGfx/Vector3.h b/Userland/Libraries/LibGfx/Vector3.h index d6888c241e9..6b7f4ae26d2 100644 --- a/Userland/Libraries/LibGfx/Vector3.h +++ b/Userland/Libraries/LibGfx/Vector3.h @@ -55,6 +55,11 @@ public: return Vector3(m_x - other.m_x, m_y - other.m_y, m_z - other.m_z); } + constexpr Vector3 operator-() const + { + return Vector3(-m_x, -m_y, -m_z); + } + constexpr Vector3 operator*(const Vector3& other) const { return Vector3(m_x * other.m_x, m_y * other.m_y, m_z * other.m_z); diff --git a/Userland/Libraries/LibGfx/Vector4.h b/Userland/Libraries/LibGfx/Vector4.h index 06accb44a1d..6f836939bab 100644 --- a/Userland/Libraries/LibGfx/Vector4.h +++ b/Userland/Libraries/LibGfx/Vector4.h @@ -60,6 +60,11 @@ public: return Vector4(m_x - other.m_x, m_y - other.m_y, m_z - other.m_z, m_w - other.m_w); } + constexpr Vector4 operator-() const + { + return Vector4(-m_x, -m_y, -m_z, -m_w); + } + constexpr Vector4 operator*(const Vector4& other) const { return Vector4(m_x * other.m_x, m_y * other.m_y, m_z * other.m_z, m_w * other.m_w);