matrix: add convenience homogenous point/vec mult

This commit is contained in:
Danny Robson 2015-07-21 01:40:00 +10:00
parent 5b8df525a2
commit a4a93a1a72
2 changed files with 23 additions and 0 deletions

View File

@ -255,6 +255,26 @@ matrix<T>::operator*=(const matrix<T> &rhs) {
}
///////////////////////////////////////////////////////////////////////////////
template <typename T>
vector<3,T>
matrix<T>::operator* (vector<3,T> v) const
{
return (
*this * v.template homog<4> ()
).template redim<3> ();
}
//-----------------------------------------------------------------------------
template <typename T>
point<3,T>
matrix<T>::operator* (point<3,T> p) const
{
return (*this * p.template homog<4> ()).template redim<3> ();
}
//-----------------------------------------------------------------------------
template <typename T>
vector<4,T>

View File

@ -42,6 +42,9 @@ namespace util {
matrix<T> operator* (const matrix<T>&) const;
matrix<T>& operator*=(const matrix<T>&);
vector<3,T> operator* (vector<3,T>) const;
point<3,T> operator* (point<3,T>) const;
vector<4,T> operator* (const vector<4,T>&) const;
point<4,T> operator* (const point<4,T> &) const;