[vtkusers] How to exactly copy a vtkTransform

Michael Knopke Michael.Knopke at gmx.de
Fri Feb 2 11:19:00 EST 2007


Hi,

I have following problem: I have a vtkBoxWidget which I can rotate. 
Now I want to pass the corresponding vtkTransform from the box to other
objects that have vtkTransforms connected in order to rotate them as well.
I don't want to set the Transform directly to that object, because  this
would also change the box's orientation/position, whenever the other objects are moved/rotated.
So solution would be to create an identical copy of that box's transform.
 
1) I tried targedTransform->DeepCopy(sourceTransform) and this would work, but I can't use it because the targedTransform is a specialized class (inherited from vtkTransform). 
Also this would always create new transforms, not very good. 

2) I created a new vtkTransform (actual my specialized class of course) and querried the sourceTransform's Orientation and rotated the new Transform like this:

orientationvector = sourceTransform->GetOrientation();

targetTransform->RotateY(orientationvector[1]);
targetTransform->RotateX(orientationvector[0]);
targetTransform->RotateZ(orientationvector[2]);

this also works but will behave strange whenever the box is rotated too much. It flips around. I'm sure it has to do with changing the coordinate-system while rotating thus changing the meaning of X,Y,Z...

Anybody knows what to do?

Michael
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer



More information about the vtkusers mailing list