[vtkusers] vtkTransform question
David Gobbi
dgobbi at irus.rri.ca
Mon Oct 15 01:37:06 EDT 2001
Hi Kiran,
The order in which you apply rotations is important.
If you get the angles like this:
xa,ya,za = transform.GetOrientation()
then to rebuild the matrix you have to do this, assuming that
the transform is in PreMultiply mode:
transform.RotateZ(za)
transform.RotateX(xa)
transform.RotateY(ya)
In VTK the 'orientation' is described by a rotation around the y axis,
followed by a rotation around the x axis, followed by a rotation around
the z axis.
My advice: whenever possible, avoid using angles to describe
rotations. If you can solve your problem completely with linear
algebra without resorting to trigonometry, the solution will
usually be much more elegant.
- David
--
David Gobbi, MSc dgobbi at irus.rri.ca
Advanced Imaging Research Group
Robarts Research Institute, University of Western Ontario
On Mon, 15 Oct 2001, Kiran, P (CORP, GEITC) wrote:
>
> Hi all:
>
> I tried to test "GetOrientation()" method of vtkTranform as following:
>
> 1) set the vtkMatrix4x4
> 2) set the matrix in step as input to vtkTransform's SetMatrix method
> 3) get the orientation matrix using Getorientation() method.
>
> These are results:
> I set the input 4x4 matrix for vtkTransform as: ( using SetMatrix() method)
> 0.999245 -0.0173388 0.0347622 0 ;
> 0.0124273 0.990517 0.136826 0;
> 0.036805 0.136291 -0.989985 0;
> 0 0 0 1;
> and I got the orientation as: {7.83328, -177.871, -1.00284}
>
> I just want to know the reverse process is correct or not, so I tried the
> following:
> 1) Set this orienataion matrix as input to vtkTransform ( using
> RotateX(),RotateY(),RotateZ() methods )
> 2) Get the 4x4 Matrix, which is a result of this orienatation.
>
> The resulting 4x4 matrix is:
> -0.999157 -0.01749 -0.0371516 0 ;
> -0.0224014 0.990428 0.136197 0 ;
> 0.0344139 0.136914 -0.989985 0 ;
> 0 0 0 1 ;
>
> There are some small discrepancies in the signs of the input and output
> matrices.
> Can someone, through some light on this.
> I am including the test file as an attachment.
>
> Thanks
> Kiran
> ----------------------------------------------------attachment--------------
> --------------------------------------------------------
>
> <<test_vtkTransform.cxx>>
>
>
>
> "THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE
> ADDRESSEE and may contain confidential and privileged information.
> If the reader of this message is not the intended recipient,
> you are notified that any dissemination, distribution or copy of this
> communication is strictly Prohibited.
> If you have received this message by error, please notify us
> immediately, return the original mail to the sender and delete the
> message from your system."
>
>
More information about the vtkusers
mailing list