[vtkusers] How do I output PolyData's points?

Amy Henderson amy.henderson at kitware.com
Tue Jul 8 14:18:56 EDT 2003


At 07:04 PM 7/8/2003 +0000, Matt Zumwalt wrote:
>Hi all,
>     I'm trying to figure out how to generate a list containing the 
> coordinates
>for all the points in a PolyData object.  I need to pass the list as
>parameters to one of the methods in an external program.   I'm sure there
>must be some simple way of doing this, but I can't figure it out.  Any help
>would be greatly appreciated.

The following should work:

vtkPoints *points = polyData->GetPoints();
int numPts = polyData->GetNumberOfPoints();
int i;

float **ptArray = new float[numPts][3];

for (i = 0; i < numPts; i++)
{
points->GetPoint(i, ptArray[i]);
}

- Amy

>thanks,
>  Matt Z
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers







More information about the vtkusers mailing list