[vtkusers] Polydata get point coordinates

David Doria daviddoria at gmail.com
Fri Oct 15 14:50:52 EDT 2010


On Fri, Oct 15, 2010 at 2:47 PM, Eric E. Monson <emonson at cs.duke.edu> wrote:
> Hey Sara,
>
> The method David advised may be the most direct for you, but I just wanted to point out that polyData->GetPoints() should return a vtkPoints object, not just point IDs. You should be able to use one of the GetPoint() variations of vtkPoints to get the coordinates from that, too.
>
> http://www.vtk.org/doc/nightly/html/classvtkPoints.html
>
> -Eric

Yep.

polydata->GetPoints()->GetPoint(i,p);

In fact, in vtkPointSet.h (the parent of vtkPolyData), the function
GetPoints (so polydata->GetPoints) is doing exactly that:

  void GetPoint(vtkIdType ptId, double x[3]) {this->Points->GetPoint(ptId,x);};

(where Points is a vtkPoints object).

David



More information about the vtkusers mailing list