[vtkusers] Rotation does not happen about the center of the image

David Gobbi david.gobbi at gmail.com
Thu Apr 4 17:52:04 EDT 2013


Hi Debjit,

Actually, changing the origin of your image is usually not the best
thing to do, because that shifts the coordinate system of your image,
which is often not a good thing to do.  What you usually want to do is
create a transformation that rotates the image around the desired
center of rotation.

Let's say that the defined center of rotation is "c", i.e. (cx, cy, cz).
To rotate around c, you have to:

1) translate by -c
2) apply a rotation
3) translate by +c

If you are using 4x4 matrices, then a translating by "c" means
applying the following 4x4 transformation matrix:

1 0 0 cx
0 1 0 cy
0 0 1 cz
0 0 0 1

We can define this matrix as "C", and similarly we can define
our pure rotation matrix as "R.  Hence, a rotation around the
point "c" is equal to:

C R C_inverse

where C_inverse just uses -c instead of +c.  So we can easily
define a new 4x4 matrix M that rotates around point "c":

M = C R C_inverse

This kind of mathematics is really the heart and soul of 3D computer
graphics (which is why it is covered in all of the good textbooks).  And
now that the majority of medical imaging is done in 3D, it is becoming
very important knowledge for that field, as well.

 - David



On Wed, Apr 3, 2013 at 1:06 PM, Ghosh, Debjit <dghosh at chla.usc.edu> wrote:
> You need to set the origin of the image about the point where you want to
> rotate it. By default it’s (0,0,0).
>
> -D



More information about the vtkusers mailing list