matrix: add scalar multiply
This commit is contained in:
parent
6ac02a9920
commit
f97c932df7
15
matrix.cpp
15
matrix.cpp
@ -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>&
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user