matrix: add scalar multiply

This commit is contained in:
Danny Robson 2015-02-19 13:23:33 +11:00
parent 6ac02a9920
commit f97c932df7
2 changed files with 16 additions and 0 deletions

View File

@ -338,6 +338,21 @@ matrix<T>::operator* (const point<4,T> &rhs) const
} }
//-----------------------------------------------------------------------------
template <typename T>
matrix<T>
matrix<T>::operator* (T f) const
{
matrix<T> out;
for (size_t i = 0; i < 4; ++i)
for (size_t j = 0; j < 4; ++j)
out.values[i][j] = values[i][j] * f;
return out;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <typename T> template <typename T>
matrix<T>& matrix<T>&

View File

@ -48,6 +48,7 @@ namespace util {
vector<4,T> operator* (const vector<4,T>&) const; vector<4,T> operator* (const vector<4,T>&) const;
point<4,T> operator* (const point<4,T> &) const; point<4,T> operator* (const point<4,T> &) const;
matrix<T> operator* (T) const;
matrix<T>& operator*= (T); matrix<T>& operator*= (T);
matrix<T> operator/ (T) const; matrix<T> operator/ (T) const;
matrix<T>& operator/= (T); matrix<T>& operator/= (T);