[vtkusers] vtkTransformCollection

David Gobbi dgobbi at atamai.com
Thu Jul 6 09:00:05 EDT 2006


Hi Jemma,

You can use vtkTransform::SetInput() or vtkTransform::Concatenate() to 
do this.


Example 1:

vtkTransform *t1 = vtkTransform::New();
t1->Translate(1,2,3);

vtkTransform *t2 = vtkTransform::New();
t2->SetInput(t1);
t2->RotateWXYZ(90, 0, 1, 0);

The transforms are linked, so if you change t1, then the t2 matrix will 
change.


Example 2:

vtkTransform *t1 = vtkTransform::New();
t1->Translate(1,2,3);

vtkTransform *t2 = vtkTransform::New();
t2->RotateWXYZ(90, 0, 1, 0);

vtkTransform *t3 = vtkTransform::New();
t3->Concatenate(t1);
t3->Concatenate(t2);

This will also link the transforms, so if t1 or t2 are changed, t3 will 
change.

Make sure that you understand PreMultiply vs. PostMultiply, since they 
change
the order in which successive transformations are applied.  The default for
vtkTransform is PreMultiply, which means that the last operation applied to
vtkTransform is actually the first operation that is applied to the 
coordinates
when the transform is used.  Usually I do everything in PostMultiply, 
since I
find it more intuitive.

 - David






adastra at inorbit.com wrote:
>
> Hi,
> I would like to link 3 transforms together just like you can with vtk 
> actors with vtkAssembly.
>
> I have tried to use vtkTransformCollection, but this is not being 
> recognised by my program (I'm using VC++ 6 and VTK 4.5)
>
> Is there another function out there that does the same thing?
>
> (I have to do all this because I can't get a valid matrix from the 
> vtkActors)
>
> Jemma
>
>
> -- 
>
> ___________________________________________________
> Play 100s of games for FREE! http://games.mail.com/
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the 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