[vtkusers] Rotating around the center of an object

Alex Malyushytskyy alexmalvtk at gmail.com
Tue Jan 17 19:46:13 EST 2012


It rotates according to transformations you define.
Rotation is defined about coordinate origin,
If you need rotate about arbitrary point,
you have first translate (object) so that point appears at the origin,
rotate, then translate back.
something like below:


	vtkSmartPointer<vtkTransform> translation =
vtkSmartPointer<vtkTransform>::New();
			translation->PostMultiply();

			translation->Translate( -center[0], -center[1], -center[2] );
  .................rotate
			translation->Translate( +center[0], +center[1], +center[2] );

Alex

On Wed, Jan 11, 2012 at 12:04 PM, David Brayford <dbrayford at gmail.com> wrote:
> Hi,
>
> I have a scene containing a 3D object and when I rotate the object
> with vtkTransform it rotates around the center of the scene and not
> the center of the object. In OpenGL I would apply the rotation to the
> object within a pushMatrix and popMatrix, but not sure I can do this
> in vtk.
>
> However, I was wondering if I can set the rotation center of the
> vtkTransform to that of the 3D object (which I know)?
>
> Thanks
> David
> _______________________________________________
> Powered by www.kitware.com
>
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list