[vtkusers] A simple question about vtkPolyData
Dai Shuo
dai_shuocn at 163.com
Wed Jun 5 09:30:00 EDT 2002
Hi Sebastien,
Thank you for the detailed reply. It works well.
>try :
>
>int index;
>for (int i=0;i<vtkPolyData->GetNumberOfPolys();i++,index++) {
>
> // looking for polygon cells / quad cells or triangle cells, you can
>remove some types if
> //you want but beware that you need to count the number of this special
>type cells for the
> //loop, or getnumberofpolys will loop too far in the cell and a memory
>error will occure.
>
> while (vtkPlyData->GetCellType(index) != VTK_POLYGON
> && (idem) != VTK_QUAD //which is also a poly
> && (idem) != VTK_TRIANGLE //idem, I can forget some types,
>refer to vtkCellTypes
> //for more types
> ) index++;
>
> vtkIdList *points = vtkIdList::New();
> vtkPolyData::GetCellPoints(index, points);
>
>// points contained in "points" are the current cell points, do whatever you
>want with it.
>// you can retrieve them by looping for points->GetNumberOfIds() in
>// vtkPolyData->GetPoint(points->GetId(x)); for each polygon/quad/triangle
>cell.
>}
>
>you can tweak this for use with get polys, which should be simpler:
>once you have your cell array, you can loop in each cell and do the same job
>:
>loop for number of ids (getpointids) and do a getcellpoints on the
>vtkpolydata
>
>
>Hope this helps
>
>Sebastien Maraux
>
>----- Original Message -----
>From: "Dai Shuo" <dai_shuocn at 163.com>
>To: "vtk" <vtkusers at public.kitware.com>
>Sent: Wednesday, June 05, 2002 3:12 AM
>Subject: [vtkusers] A simple question about vtkPolyData
>
>
>Hi, all
> I have a vtkPolyData, and I know it's composed of some polygons.
>Now I want to get the point list of each polygon, how?
>vtkPolyData::GetPolys()
>seems helpful, but I don't know how to deal with a vtkCellArray which it
>returns.
>Please give me a solution. Thank you very much!
>
> Dai Shuo
> dai_shuocn at 163.com
> 2002-06-05
>
>
>
>_______________________________________________
>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://public.kitware.com/mailman/listinfo/vtkusers
>
>_______________________________________________
>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://public.kitware.com/mailman/listinfo/vtkusers
>.
= = = = = = = = = = = = = = = = = = = =
Dai Shuo
dai_shuocn at 163.com
2002-06-05
More information about the vtkusers
mailing list