add operator *= for vectors

This commit is contained in:
David Markowitz 2023-08-09 22:13:20 -07:00
parent fe6be21008
commit ad81e341da
2 changed files with 9 additions and 0 deletions

View File

@ -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);

View File

@ -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;