implement unary negative on vectors

This commit is contained in:
Leonetienne
2025-12-14 21:59:22 +01:00
parent 9b3caf511c
commit e87653ab47
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -158,3 +158,8 @@ void Vector3d::normalize() noexcept
y *= inv; y *= inv;
z *= inv; z *= inv;
} }
Vector3d Vector3d::operator-() const noexcept
{
return Vector3d(-x, -y, -z);
}
+1
View File
@@ -24,6 +24,7 @@ public:
Vector3d normalized() const noexcept; Vector3d normalized() const noexcept;
void normalize() noexcept; void normalize() noexcept;
Vector3d operator-() const noexcept;
Vector3d& operator=(const Vector3d& other) noexcept; Vector3d& operator=(const Vector3d& other) noexcept;
Vector3d& operator=(Vector3d&& other) noexcept; Vector3d& operator=(Vector3d&& other) noexcept;