Hi, all<br><br>I am looking into a 3D shape model. It has 5,000+ points, and 9,000+ cells. Thus in the .vtk file, I have the polygon data in the format such as follows<br><br>POLYGONS 9637 38548<br>3 0 1 2 <br>3 1 3 4 <br>
3 2 1 4 <br>3 3 5 6 <br>3 4 3 6 <br>3 5 7 8 <br>.......<br><br>The first number of each line indicates how many points are included in the cell, and the next 3 numbers indicate the point ids. In my case, the polygon is combined by triangles.<br>
<br>I use <b>vtkGenericDataObjectReader</b> to open the .vtk file, and then use <b>vtkPolyData::GetPolys</b> to get the polygons of the shape model, whose type is <b>vtkCellArray</b> pointer.<br><br>Here is my code clip:<br>
vtkSmartPointer<vtkGenericDataObjectReader> reader = vtkSmartPointer<vtkGenericDataObjectReader>::New();<br> reader->SetFileName("C:\\meanshape.vtk");<br> reader->OpenVTKFile();<br> reader->Update();<br>
<br> vtkSmartPointer<vtkPolyData> shape = vtkSmartPointer<vtkPolyData>::New();<br> shape = reader->GetPolyDataOutput();<br><br> vtkSmartPointer<vtkCellArray> polys = vtkSmartPointer<vtkCellArray>::New();<br>
polys = shape->GetPolys();<br><b><br>My problem is:</b> After I have polygon data in a vtkCellArray instance, how can I get access to the point ids in each triangle cell? For example, I want to read "0 1 2" in the first line, "1 3 4" in the second line, etc.<br>
<br>Can you help me out of this? Many thanks in advance for your kind help.<br><br>All bests<br>Wenlong<br>