matrix: add scalar multiply

This commit is contained in:
Danny Robson 2014-12-15 13:43:53 +11:00
parent 82f318c8ad
commit dcdbbe938d
2 changed files with 14 additions and 2 deletions

View File

@ -336,6 +336,18 @@ matrix<T>::operator* (const vector<4> &rhs) const {
}
//-----------------------------------------------------------------------------
template <typename T>
matrix<T>&
matrix<T>::operator*= (T f){
for (size_t i = 0; i < 4; ++i)
for (size_t j = 0; j < 4; ++j)
values[i][j] *= f;
return *this;
}
//-----------------------------------------------------------------------------
template <typename T>
matrix<T>

View File

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