[vtkusers] Index of points stored in vtkPolyData?

BBerco bebe0705 at colorado.edu
Mon Jul 25 14:45:27 EDT 2016


Dear all,

I'm storing point coordinates in a vtkPolyData object *points_polydata*. The
corresponding points are then displayed in a VTK window.

Using the proper interactor, I am able to "select" points that are inside a
rectangular box using 

*
vtkSmartPointer<vtkSelectVisiblePoints> selectVisiblePoints  =
vtkSmartPointer<vtkSelectVisiblePoints>::New();

//... Extra lines where the renderer is associated with selectVisiblePoints

selectVisiblePoints -> SetInputDataObject(points_polydata);

vtkSmartPointer<vtkPolyData> visiblePointsPolyData =
selectVisiblePoints->GetOutput();
*

*visiblePointsPolyData* stores the coordinates of the selected points, as I
can print them with

*vtkSmartPointer<vtkPoints> points = visiblePointsPolyData->GetPoints();

for (int i = 0 ; i < points->GetNumberOfPoints(); ++i){
            	double p[3];
            	points -> GetPoint (i, p);
            	std::cout << p[0]<< p[1] << p[2] << std::endl;
            }
*

>From this, I would like to be able to modify the coordinates of the selected
points in the original *points_polydata*. To do so, I would need the index
of the selected points to know where they stand in the original
*points_polydata* (for instance, the 3 selected points are the 2n, 4th and
6th points in *points_polydata*). I know that I could use a
getClosestPoint() method on each of the selected point against the original
*points_polydata* to directly get this association, but I am afraid this
could become inefficient when *points_polydata* contains a large number of
points.

How would you do this? Thanks!




--
View this message in context: http://vtk.1045678.n5.nabble.com/Index-of-points-stored-in-vtkPolyData-tp5739338.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list