[vtkusers] [Insight-users] Insight-users Digest, Vol 70, Issue 5

David Doria daviddoria+vtk at gmail.com
Tue Feb 2 10:43:53 EST 2010


2010/2/2 Sylvain Jaume <sylvain at csail.mit.edu>

> 你好阿尔赛斯,
>
> (Next time you may have more luck sending your VTK questions to <
> vtkusers at vtk.org>.)
>
> To retrieve the geometry and topology information from a vtkPolyData you
> can do something like this:
>
>
> double pt[3];
> vtkIdType npts, *pts;
>
> int numPts = myPolyData->GetNumberOfPoints();
>
> for (int i=0; i < numPts; i++)
> {
>   myPolyData->GetPoint(m,pt);
>   std::cout << "point with index " << i << ": (" << pt[0] << " " << pt[1]
> << " " << pt[2] << ")" << std::endl;
> }
>
> myPolyData->GetCells()->InitTraversal();
>
> while (myPolyData->GetCells()->GetNextCell(npts,pts))
> {
>   std::cout << "cell has " << npts << " points with indices:";
>
>   for (int i=0; i < npts; i++)
>   {
>     std::cout << " " << pts[i];
>   }
>
>   std::cout << std::endl;
> }
>
> You might need to try and compile this code as I have just typed it into
> GMail without compiling.
>
> Regards,
> Sylvain
>
>
Folks,

There are many examples of this type of thing here:
http://www.vtk.org/Wiki/VTK/Examples

Namely:
http://www.vtk.org/Wiki/VTK/Examples/IO/ReadPolyData

Good luck!

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100202/3276d5d7/attachment.htm>


More information about the vtkusers mailing list