From 437d2092005001d7f9efe2c9534c4ce0e6ad47c3 Mon Sep 17 00:00:00 2001 From: Quinn Date: Mon, 3 Feb 2025 15:21:22 -0500 Subject: [PATCH] Added a scalar divisor operator --- src/Vector3D.cpp | 6 ++++++ src/Vector3D.hpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/Vector3D.cpp b/src/Vector3D.cpp index d34daa4..ed06655 100644 --- a/src/Vector3D.cpp +++ b/src/Vector3D.cpp @@ -78,6 +78,12 @@ V3D V3D::operator*(Type scalar) const return V3D{this->x * scalar, this->y * scalar, this->z * scalar}; } +template +V3D V3D::operator/(Type scalar) const +{ + return V3D{this->x / scalar, this->y / scalar, this->z / scalar}; +} + template V3D &V3D::operator+=(const V3D &other) { diff --git a/src/Vector3D.hpp b/src/Vector3D.hpp index f0c36ce..be5f7b4 100644 --- a/src/Vector3D.hpp +++ b/src/Vector3D.hpp @@ -26,6 +26,8 @@ public: V3D operator*(Type scalar) const; + V3D operator/(Type scalar) const; + void operator=(const V3D &other); V3D &operator+=(const V3D &other);