[vtkusers] vtkTransform and Rotations !!

Glen Lehmann glehmann at imaging.robarts.ca
Thu Mar 27 15:16:03 EST 2003


Hi Sebastien,

vtkTransform performs rotations in the ZXY order.  If you do something like;

newTransform->RotateZ(Rz);
newTransform->RotateX(Rx);
newTransform->RotateY(Ry);

then GetOrientation() will will return what you expect.  

I hope this helps you out,
Glen

Sebastien Auclair wrote:

>Hi folks !
>
>I need to create a rotation matrix for x,y and z . (Please note that we
>aren't using vtkActor for transformation...neither vtkWindowInteractor ...)
>
>I have read every post in the usergroup's repository and nothing really
>helped.
>
>The problem is that GetOrientation never produces to correct result.
>
>This is essentially how I do it :
>##################################################################
>vtkMatrix4x4 *matrix = vtkMatrix4x4::New();
>vtkTransform* newTransform = vtkTransform::New();
>newTransform->Identity();
>newTransform->PostMultiply();
>newTransform->Translate(-(m_origin[0]), -(m_origin[1]), -(m_origin[2]));
>
>newTransform->RotateWXYZ(y, 0,1,0);
>newTransform->RotateWXYZ(x, 1,0,0);
>newTransform->RotateWXYZ(z, 0,0,1);
>newTransform->Translate((m_origin[0]), (m_origin[1]), (m_origin[2]));
>float test[3] ;
>newTransform->GetOrientation(test);
>##################################################################
>For exemple,  if we try to rotate with (X=90, Y=90, Z=0), we get orientation
>(X=90, Y=0, Z=90).
>And what is the difference between RotateX and RotateWXYZ (a, 1, 0, 0)
>??????
>
>
>Thanks for any help.
>___________________________________________________
>Seb
>
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
>
>  
>





More information about the vtkusers mailing list