[vtkusers] How to make series of transformation?

rakesh patil prakeshofficial at gmail.com
Wed Mar 14 23:31:49 EDT 2012


Hello,

I am using this particular code to perform the following set of
transformations

Translate -> Rotate -> Translate

vtkSmartPointer<vtkTransform> ntrans = vtkSmartPointer<vtkTransform>::New();
ntrans->Translate(np);

vtkSmartPointer<vtkTransform> ptrans = vtkSmartPointer<vtkTransform>::New();
ptrans->Translate(pp);

vtkSmartPointer<vtkTransform> rotateTrans =
vtkSmartPointer<vtkTransform>::New();
rotateTrans->RotateZ(rot_angle);

vtkSmartPointer<vtkTransformPolyDataFilter> nTranslateFilter =
       vtkSmartPointer<vtkTransformPolyDataFilter>::New();
nTranslateFilter->SetInput( polyData );   // polyData is an object of type
vtkPolyData
nTranslateFilter->SetTransform(ntrans);
nTranslateFilter->Update();

vtkSmartPointer<vtkTransformPolyDataFilter> rotateFilter =
       vtkSmartPointer<vtkTransformPolyDataFilter>::New();
rotateFilter->SetInputConnection( nTranslateFilter->GetOutputPort() );
rotateFilter->SetTransform(rotateTrans);
rotateFilter->Update();

vtkSmartPointer<vtkTransformPolyDataFilter> pTranslateFilter =
       vtkSmartPointer<vtkTransformPolyDataFilter>::New();
pTranslateFilter->SetInputConnection( rotateFilter->GetOutputPort() );
pTranslateFilter->SetTransform(ptrans);
pTranslateFilter->Update();

vtkSmartPointer<vtkPolyDataMapper> pdmapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
pdmapper->SetInputConnection(pTranslateFilter->GetOutputPort() );
pdmapper->ScalarVisibilityOff();

vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(pdmapper);


With this code, I can see that the transformation is done only till
rotation. Next translation is not shown. Can anyone point out where I am
going wrong?

Thanks in advance

Regards
Rakesh Patil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120315/631f2e41/attachment.htm>


More information about the vtkusers mailing list