diff --git a/include/Spectre/Math/Matrix3.h b/include/Spectre/Math/Matrix3.h index d962cee..04c47d0 100644 --- a/include/Spectre/Math/Matrix3.h +++ b/include/Spectre/Math/Matrix3.h @@ -58,7 +58,16 @@ struct Matrix3 inline Matrix3 operator*(const Matrix3& mat) const; inline Matrix3 operator*=(const Matrix3& mat); - // Need scalar, vector arithmetic? + + // ----------------- + // Arithmetic: Scalar + // ----------------- + + inline Matrix3 operator/(T value) const; + inline Matrix3 operator/=(T value); + + inline Matrix3 operator*(T value) const; + inline Matrix3 operator*=(T value); // ----------------- // Named operations. diff --git a/include/Spectre/Math/Matrix3.inl b/include/Spectre/Math/Matrix3.inl index f63cdab..465f770 100644 --- a/include/Spectre/Math/Matrix3.inl +++ b/include/Spectre/Math/Matrix3.inl @@ -87,6 +87,39 @@ inline Matrix3 Matrix3::operator*=(const Matrix3& mat) return *this; } +template +inline Matrix3 Matrix3::operator/(T value) const +{ + return Matrix3( + v[0] / value, v[1] / value, v[2] / value, + v[3] / value, v[4] / value, v[5] / value, + v[6] / value, v[7] / value, v[8] / value); +} + +template +inline Matrix3 Matrix3::operator/=(T value) +{ + *this = *this / value; + return *this; +} + +template +inline Matrix3 Matrix3::operator*(T value) const +{ + return Matrix3( + v[0] * value, v[1] * value, v[2] * value, + v[3] * value, v[4] * value, v[5] * value, + v[6] * value, v[7] * value, v[8] * value); +} + +template +inline Matrix3 Matrix3::operator*=(T value) +{ + *this = *this * value; + return *this; +} + + template float Matrix3::det() const {