matrix: add convenience homogenous point/vec mult
This commit is contained in:
parent
5b8df525a2
commit
a4a93a1a72
20
matrix.cpp
20
matrix.cpp
@ -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>
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user