[vtkusers] Rotate Polydata before extrusion?

Michael Knopke Michael.Knopke at gmx.de
Tue Mar 27 08:51:42 EDT 2007


Thanks Hendrik, thats exactly what I need :-)

 

Another problem is getting the "normal" vector from a plane that was rotated
via vtkTransform. Because here I can't use vtkTransformPolyDataFilter I
guess.

 

I was trying to calculate the vector by hand but the values are wrong, maybe
a problem with the right order?

 

Here is my code:

 

       double NormalPlane[3];

       double OrientationAngles[3];

 

       Plane->GetNormal(NormalPlane);  // normal is 0,0,1

       planeTransform->GetOrientation(OrientationAngles); //returns rotation
angles X,Y,Z

   

 

       // z rotation    

       NormalPlaneTemp[0] = NormalPlane[0]*cos(OrientationAngles[2]) -
NormalPlane[1]*sin(OrientationAngles[2]);

       NormalPlaneTemp[1] = NormalPlane[0]*sin(OrientationAngles[2]) +
NormalPlane[1]*cos(OrientationAngles[2]);

       NormalPlaneTemp[2] = NormalPlane[2];

 

 

       NormalPlane[0] = NormalPlaneTemp[0];

       NormalPlane[1] = NormalPlaneTemp[1];

       NormalPlane[2] = NormalPlaneTemp[2];

 

       // X rotation

       NormalPlaneTemp[0] = NormalPlane[0];

       NormalPlaneTemp[1] = NormalPlane[1]*cos(OrientationAngles[0]) -
NormalPlane[2]*sin(OrientationAngles[0]);

       NormalPlaneTemp[2] = NormalPlane[1]*sin(OrientationAngles[0]) -
NormalPlane[2]*cos(OrientationAngles[0]);

 

       NormalPlane[0] = NormalPlaneTemp[0];

       NormalPlane[1] = NormalPlaneTemp[1];

       NormalPlane[2] = NormalPlaneTemp[2];

 

       // Y rotation

       NormalPlaneTemp[0] = NormalPlane[2]*sin(OrientationAngles[1]) +
NormalPlane[0]*cos(OrientationAngles[1]);

       NormalPlaneTemp[1] = NormalPlane[1];

       NormalPlaneTemp[2] = NormalPlane[2]*cos(OrientationAngles[1]) -
NormalPlane[0]*sin(OrientationAngles[1]);

 

       NormalPlane[0] = NormalPlaneTemp[0];

       NormalPlane[1] = NormalPlaneTemp[1];

       NormalPlane[2] = NormalPlaneTemp[2];

 

 

Thanks a lot

 

Regards

 

Michael

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070327/77e1f3c5/attachment.htm>


More information about the vtkusers mailing list