Commit ea22bc95 by Pierre Kraemer

ajout fonction rotate + bug polyhedron cylinder

parent 9a48f6a3
 ... ... @@ -431,7 +431,7 @@ Dart Polyhedron::cylinder_topo(unsigned int n, unsigned int z, bool top_clo if (top_closed) { Dart d = m_map.phi_1(m_tableVertDarts[n*z]); if(m_map.closeHole(d, true)) if(m_map.closeHole(d, false)) { d = m_map.phi2(d); if(m_map.faceDegree(d) > 3) ... ...
 ... ... @@ -89,6 +89,9 @@ void rotateX(T angle, Matrix<4,4,T>& mat); template void rotate(T axis_x, T axis_y, T axis_z, T angle, Matrix<4,4,T>& mat); template void rotate(Vector<3,T>& axis, T angle, Matrix<4,4,T>& mat); /** * Apply a transformation (stored in matrix) to a 3D point * @param P the point to transfo ... ...
 ... ... @@ -24,12 +24,13 @@ namespace CGoGN { namespace Geom { template void scale(T sx, T sy, T sz, Matrix<4,4,T>& mat) { template void scale(T sx, T sy, T sz, Matrix<4,4,T>& mat) { Matrix<4,4,T> mat_scale; mat_scale(0,0) = sx; ... ... @@ -53,12 +54,12 @@ namespace Geom mat_scale(3,3) = T(1); mat = mat_scale * mat; } } template void translate(T tx, T ty, T tz, Matrix<4,4,T>& mat) { template void translate(T tx, T ty, T tz, Matrix<4,4,T>& mat) { Matrix<4,4,T> mat_trans; mat_trans(0,0) = T(1); ... ... @@ -82,11 +83,11 @@ namespace Geom mat_trans(3,3) = T(1); mat = mat_trans * mat; } } template void rotateZ(T angle, Matrix<4,4,T>& mat) { template void rotateZ(T angle, Matrix<4,4,T>& mat) { Matrix<4,4,T> mat_rot; T c = std::cos(angle); ... ... @@ -113,12 +114,11 @@ namespace Geom mat_rot(3,3) = T(1); mat = mat_rot * mat; } } template void rotateY(T angle, Matrix<4,4,T>& mat) { template void rotateY(T angle, Matrix<4,4,T>& mat) { Matrix<4,4,T> mat_rot; T c = std::cos(angle); ... ... @@ -145,11 +145,11 @@ namespace Geom mat_rot(3,3) = T(1); mat = mat_rot * mat; } } template void rotateX(T angle, Matrix<4,4,T>& mat) { template void rotateX(T angle, Matrix<4,4,T>& mat) { Matrix<4,4,T> mat_rot; T c = std::cos(angle); ... ... @@ -176,11 +176,11 @@ namespace Geom mat_rot(3,3) = T(1); mat = mat_rot * mat; } } template void rotate(T axis_x, T axis_y, T axis_z, T angle, Matrix<4,4,T>& mat) { template void rotate(T axis_x, T axis_y, T axis_z, T angle, Matrix<4,4,T>& mat) { T length = T( std::sqrt(double(axis_x*axis_x + axis_y*axis_y + axis_z*axis_z))); axis_x /=length; axis_y /=length; ... ... @@ -200,7 +200,6 @@ namespace Geom Matrix<4,4,T> mat_rot; mat_rot(0,0) = xx + c * (T(1) - xx); mat_rot(1,0) = yx - c * yx + s * axis_z; mat_rot(2,0) = zx - c * zx - s * axis_y; ... ... @@ -221,19 +220,23 @@ namespace Geom mat_rot(2,3) = T(0); mat_rot(3,3) = T(1); mat = mat_rot * mat; } } template void rotate(Vector<3,T>& axis, T angle, Matrix<4,4,T>& mat) { rotate(axis[0], axis[1], axis[2], angle, mat) ; } template Vector<3,T> transform(const Vector<3,T>& P,const Matrix<4,4,T>& mat) { Vector<4,T> Q(P[0],P[1],P[2],T(1)); Vector<4,T> R = mat*Q; return Vector<3,T>(R[0]/R[3],R[1]/R[3],R[2]/R[3]); } template Vector<3,T> transform(const Vector<3,T>& P,const Matrix<4,4,T>& mat) { Vector<4,T> Q(P[0], P[1], P[2], T(1)); Vector<4,T> R = mat * Q; return Vector<3,T>(R[0]/R[3], R[1]/R[3], R[2]/R[3]); } } // namespace Geom } } } // namespace CGoGN
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!