# [vtkusers] Rotating a vtk actor using world coordinates

Chiranjib Sur sur.chiranjib at gmail.com
Tue Sep 29 06:46:15 EDT 2015

```Hi,
The implementation of the rotation transform are as follows (from
vtkTransform.h file : URL
https://github.com/Kitware/VTK/blob/master/Common/Transforms/vtkTransform.h)

void RotateX(double angle) { this->RotateWXYZ(angle, 1, 0, 0); }; void
RotateY(double angle) { this->RotateWXYZ(angle, 0, 1, 0); }; void RotateZ(
double angle) { this->RotateWXYZ(angle, 0, 0, 1); }; Therefore, how there
going to be a difference between

actor->RotateX(45);
actor->RotateY(45);

and

actor->RotateWXYZ(45, 1, 0, 0);
actor->RotateWXYZ(45, 0, 1, 0);

Can anyone please explain this a bit? David, Is there any example of the
SetUserMatrix() available to learn about it?

Thanks,
Chiranjib

On Mon, Aug 10, 2015 at 10:38 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> Hi Drak,
>
> Generally it's better design to build a transform or matrix and then apply
> that to the actor via SetUserTransform() or SetUserMatrix().  That way, the
> transform or matrix is available to you if you have to move other points or
> actors between coordinate systems.
>
> To rotate around a point in space, you have to apply a translation to put
> that point at the origin, then do the rotation, and then translate back
> again.
>
>  - David
>
> On Mon, Aug 10, 2015 at 10:53 AM, Drak <draktharrblorf at gmail.com> wrote:
>
>> I should add that I'm using the vtkImageActor with a vtkImageData as a
>> source. It seems that my point of rotation is the bottom left of my image
>>
>
> _______________________________________________
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>