From 85175e7dc414de2a9d754ca4ed08ccddf504cc43 Mon Sep 17 00:00:00 2001 From: nicopietroni Date: Thu, 19 Apr 2007 14:30:26 +0000 Subject: [PATCH] added RotationMatrix method to calculate rotation matrix along an axis --- vcg/math/matrix33.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/vcg/math/matrix33.h b/vcg/math/matrix33.h index 4561e845..df3cd7e0 100644 --- a/vcg/math/matrix33.h +++ b/vcg/math/matrix33.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.17 2007/04/07 23:06:47 pietroni +Added function RotationMatrix + Revision 1.16 2007/01/29 00:20:25 pietroni -Used scalar type passed as template argument istead of double to prevent warnings.. in Rotate function @@ -646,6 +649,19 @@ Matrix33 RotationMatrix(vcg::Point3 v0,vcg::Point3 v1,bool normalized=t return rotM; } +///return the rotation matrix along axis +template +Matrix33 RotationMatrix(const vcg::Point3 &axis, + const float &angleRad) + { + vcg::Matrix44 matr44; + vcg::Matrix33 matr33; + matr44.SetRotate(angleRad,axis); + for (int i=0;i<3;i++) + for (int j=0;j<3;j++) + matr33[i][j]=matr44[i][j]; + return matr33; + } /// typedef Matrix33 Matrix33s;