diff --git a/vcg/math/matrix33.h b/vcg/math/matrix33.h index 2da2c504..356a10db 100644 --- a/vcg/math/matrix33.h +++ b/vcg/math/matrix33.h @@ -75,6 +75,15 @@ public: m(i,j)=(*this)[i][j]; } + template + EigenMatrix33Type ToEigenMatrix() const { + EigenMatrix33Type m; + for(int i = 0; i < 3; i++) + for(int j = 0; j < 3; j++) + m(i,j)=(*this)[i][j]; + return m; + } + template void FromEigenMatrix(const EigenMatrix33Type & m){ for(int i = 0; i < 3; i++) @@ -82,6 +91,8 @@ public: (*this)[i][j]=m(i,j); } + + static inline const Matrix33 &Identity( ) { static Matrix33 tmp; tmp.SetIdentity(); diff --git a/vcg/math/matrix44.h b/vcg/math/matrix44.h index 7ca46188..cb2f8c7c 100644 --- a/vcg/math/matrix44.h +++ b/vcg/math/matrix44.h @@ -158,6 +158,15 @@ public: m(i,j)=(*this)[i][j]; } + template + EigenMatrix44Type ToEigenMatrix() const { + EigenMatrix44Type m; + for(int i = 0; i < 4; i++) + for(int j = 0; j < 4; j++) + m(i,j)=(*this)[i][j]; + return m; + } + template void FromEigenMatrix(const EigenMatrix44Type & m){ for(int i = 0; i < 4; i++)