Added operator*=( std::vector<PointType> ...) to apply a matrix to a vector of vertexes (replacement of the old style mesh.Apply(tr).

This commit is contained in:
Paolo Cignoni 2005-03-15 11:40:56 +00:00
parent 41945cf2d5
commit 27694f7a67
1 changed files with 10 additions and 0 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.22 2004/12/15 18:45:50 tommyfranken
*** empty log message ***
Revision 1.21 2004/10/22 14:41:30 ponchio Revision 1.21 2004/10/22 14:41:30 ponchio
return in operator+ added. return in operator+ added.
@ -64,6 +67,7 @@ Revision 1.12 2004/03/25 14:57:49 ponchio
#include <vcg/math/base.h> #include <vcg/math/base.h>
#include <vcg/space/point3.h> #include <vcg/space/point3.h>
#include <vcg/space/point4.h> #include <vcg/space/point4.h>
#include <vector>
namespace vcg { namespace vcg {
@ -381,6 +385,12 @@ template <class T> void Matrix44<T>::operator*=( const Matrix44 & m ) {
} */ } */
} }
template < class PointType , class T > void operator*=( std::vector<PointType> &vert, const Matrix44<T> & m ) {
std::vector<PointType>::iterator ii;
for(ii=vert.begin();ii!=vert.end();++ii)
(*ii).P()=m * (*ii).P();
}
template <class T> void Matrix44<T>::operator*=( const T k ) { template <class T> void Matrix44<T>::operator*=( const T k ) {
for(int i = 0; i < 4; i++) for(int i = 0; i < 4; i++)
operator[](i) *= k; operator[](i) *= k;