[vtkusers] Polydata get point coordinates

David Doria daviddoria at gmail.com
Fri Oct 15 14:26:40 EDT 2010


On Fri, Oct 15, 2010 at 2:13 PM, Sara Rolfe <smrolfe at u.washington.edu> wrote:
> Hello,
> I'm trying to get the 3D coordinates of polydata points.  I have been
> used polyData->GetPoints();, which returns the point ID, but not the
> location.  How can I access this information?
> Thanks,
> Sara

This should do the trick:

for(vtkIdType i = 0; i < polydata->GetNumberOfPoints(); i++)
  {
  double p[3];
  polydata->GetPoint(i, p);
  std::cout << "Point " << i << " : " << p[0] << " " << p[1] << " " <<
p[2] << std::endl;
  }

David



More information about the vtkusers mailing list