Hi;
I have closed surface generated from segmentation using Flying edges. I want retreive triangle and points from each cell
here is my code:
for(int i = 0; i < FEMesh->GetNumberOfCells(); i++)
{
vtkSmartPointer cell = FEMesh->GetCell(i);
vtkSmartPointer triangle = vtkTriangle::SafeDownCast(cell);
double p0[3];
double p1[3];
double p2[3];
triangle->GetPoints()->GetPoint(0, p0);
triangle->GetPoints()->GetPoint(1, p1);
triangle->GetPoints()->GetPoint(2, p2);
triangle_points->InsertNextPoint(p0[0], p0[1], p0[2]);
triangle_points->InsertNextPoint(p1[0], p1[1], p1[2]);
triangle_points->InsertNextPoint(p2[0], p2[1], p2[2]);
triangles->InsertNextCell(triangle);
}
in order to check if all triangle and points are well recovered, I stored points and triangles in vtkPolydata (the mesh is deformed, I want keep the initial form how can I obtain this). see attached figure of deformed mesh
Polydata->SetPoints(triangle_points);
Polydata->SetPolys(triangles);
Thank’s in advance