[vtkusers] Origin of rotation using interactor.

Jens Ivar Jørdre JensIvar at nordicimaginglab.com
Fri Feb 23 10:47:52 EST 2007


Hi.

 

In the search for a solution to my problem rotating a sphere using vtkRenderWindowInteractor I've now come to posting on this list. 

 

The problem is the following: In my rendered scene I have an interactor with which I transform a sphere. However, I am only able to rotate the sphere around its center. If I set the origin of rotation using vtkProp3D::SetOrigin(double*) the interactor still rotates my sphere around its center. 

 

Somewhat more in depth in my pipeline I define a sphere (using vtkSphereSource piping to vtkPolyDataMapper piping to vtkActor). I have a transformation matrix M defined already that I want to apply to my sphere. The matrix contains translation, rotation, scaling and an origin (vertex) for the rotation and scaling. Thus the only difference between my matrix and the intrinsic matrix of the actor is that my order of rotation is not necessarily R(Z) * R(X) * R(Y). After I use the interactor of my scene to rotate, translate or scale my sphere I want to retrieve the transformation parameters from the sphere and use it elsewhere.

 

Now, after I define my sphere I would like to position the sphere according to my (external) transformation matrix M. One way to do this is to convert my (non-VTK) matrix to vtkMatrix4x4 and  call my actor's SetUserMatrix(vtkMatrix4x4*). Another way is to extract transformation parameters from M and apply these using vtkProp3D's SetPosition(double*), SetOrientation(double*), SetScale(double*) and SetOrigin(double*). However, even though the vtkProp3D.h reads "Set/Get the origin of the Prop3D. This is the point about which all rotations take place." the interactor in my scene only rotates around the sphere center. 

 

Thus my question amounts to the following: How can I have the interactor rotate the sphere around the origin specified using vtkProp3D::SetOrigin(double*)?

 

Kind regards

Jens Ivar Jørdre

 

(This mail was recent as in my first attempt my "From:" e-mail address was not the one registered with the vtkusers list. Sorry if you got it more than once.)

 

--

Jens Ivar Jørdre, Ph.D.

Software Developer @ NordicImagingLab AS

Møllendalsveien 61A, N-5009 Bergen, Norway
Phone: +47 55 70 70 95 / +47 90 12 19 74
Fax: +47 55 70 70 96

 

 

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


More information about the vtkusers mailing list