From ad81e341da474cfa9209bd59c93d4d9074259878 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Wed, 9 Aug 2023 22:13:20 -0700 Subject: [PATCH] add operator *= for vectors --- dCommon/NiPoint3.cpp | 7 +++++++ dCommon/NiPoint3.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/dCommon/NiPoint3.cpp b/dCommon/NiPoint3.cpp index 20780815..5ad06f30 100644 --- a/dCommon/NiPoint3.cpp +++ b/dCommon/NiPoint3.cpp @@ -136,6 +136,13 @@ NiPoint3& NiPoint3::operator+=(const NiPoint3& point) { return *this; } +NiPoint3& NiPoint3::operator*=(const float scalar) { + this->x *= scalar; + this->y *= scalar; + this->z *= scalar; + return *this; +} + //! Operator for subtraction of vectors NiPoint3 NiPoint3::operator-(const NiPoint3& point) const { return NiPoint3(this->x - point.x, this->y - point.y, this->z - point.z); diff --git a/dCommon/NiPoint3.h b/dCommon/NiPoint3.h index c956b654..44c3c383 100644 --- a/dCommon/NiPoint3.h +++ b/dCommon/NiPoint3.h @@ -138,6 +138,8 @@ public: //! Operator for addition of vectors NiPoint3& operator+=(const NiPoint3& point); + NiPoint3& operator*=(const float scalar); + //! Operator for subtraction of vectors NiPoint3 operator-(const NiPoint3& point) const;