include/Spectre/Math/Matrix3.h: Adding multiplication and division scalar operations.
This commit is contained in:
parent
c313c5134f
commit
6e8f060882
2 changed files with 43 additions and 1 deletions
|
|
@ -58,7 +58,16 @@ struct Matrix3
|
|||
inline Matrix3<T> operator*(const Matrix3<T>& mat) const;
|
||||
inline Matrix3<T> operator*=(const Matrix3<T>& mat);
|
||||
|
||||
// Need scalar, vector arithmetic?
|
||||
|
||||
// -----------------
|
||||
// Arithmetic: Scalar
|
||||
// -----------------
|
||||
|
||||
inline Matrix3<T> operator/(T value) const;
|
||||
inline Matrix3<T> operator/=(T value);
|
||||
|
||||
inline Matrix3<T> operator*(T value) const;
|
||||
inline Matrix3<T> operator*=(T value);
|
||||
|
||||
// -----------------
|
||||
// Named operations.
|
||||
|
|
|
|||
|
|
@ -87,6 +87,39 @@ inline Matrix3<T> Matrix3<T>::operator*=(const Matrix3<T>& mat)
|
|||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline Matrix3<T> Matrix3<T>::operator/(T value) const
|
||||
{
|
||||
return Matrix3<T>(
|
||||
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<typename T>
|
||||
inline Matrix3<T> Matrix3<T>::operator/=(T value)
|
||||
{
|
||||
*this = *this / value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline Matrix3<T> Matrix3<T>::operator*(T value) const
|
||||
{
|
||||
return Matrix3<T>(
|
||||
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<typename T>
|
||||
inline Matrix3<T> Matrix3<T>::operator*=(T value)
|
||||
{
|
||||
*this = *this * value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
float Matrix3<T>::det() const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue