View Full Version : How to change polygon 3D object position in pcl visualizer?

24th December 2019, 11:32

I have successfully loaded the polygon mesh 3D object file but every time it's loaded on the center position of the viewer.

boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer;
I have tried below but its only helping me to change roatation and its scale but not position.

vtkSmartPointer<vtkTransform> transform = vtkSmartPointer<vtkTransform>::New();
transform->Scale(10, 10, 10);
viewer->addModelFromPolyData(poly_data, transform, "poly_id", 0);
I want to change the position of the object file, like based on user preference I want to set axis center on front/back edge of car.
Please give me some suggestions.


24th December 2019, 18:21
Well, vtkTransform (https://vtk.org/doc/nightly/html/classvtkTransform.html)-does- have a Translate() method. You found Rotate() and Scale(), why didn't you find Translate()?

25th December 2019, 06:39
Actually I have tried this, but used some big values that set that object too far from the origin, looks hidden to me and that's why I didn't try again.

But yes it's working. Thanks :)