[vtkusers] How to report a rotation of VTKAssembly in object coontained

David Doria daviddoria+vtk at gmail.com
Thu Mar 18 13:06:18 EDT 2010


On Thu, Mar 18, 2010 at 12:49 PM, orobin <Olivier.Robin at bioclinica.com> wrote:
>
> Hello
>
> I have a VTKAssembly.
>
> this assembly contain some vtkActor, a vtkLineSource
>
> if I rotate the vtkAssemble, with .RotateZ(...) it works on the screen (easy
> for me, I just give an angle, and the rotation is done)
>
> but when I go into my objects, contained in the VTKAssembly, all the
> coordinates are the same than the beginning.
>
> I need to have the new coordinate of the object, which are inside the
> vtkAssembly, after the rotation.
>
> I would like to avoid to calculate it myself, because later, I will do it
> for really complex object, in the Assembly.
>
> Any idea of how I can do it ?
>
> thank you
> Olivier Robin
>

You are correct, when the assembly is rotated, it is all done in
openGL, hence your actual data is not transformed.

You can get the current position (transformation matrix) of an actor like this:
http://www.vtk.org/Wiki/VTK/Examples/RotateActor

(I'm pretty sure it is identical for an assembly)

You can then transform your actual object to the position the assembly
was in like this:
http://www.vtk.org/Wiki/VTK/Examples/TransformPolyData
or this:
http://www.vtk.org/Wiki/VTK/Examples/TransformFilter

Thanks,

David



More information about the vtkusers mailing list