Skip to content
Snippets Groups Projects
Commit a8959a29 authored by Alexis Girault's avatar Alexis Girault
Browse files

ENH: Triangulate polydata in VTK reader

Ensure the surface mesh read will only have triangles and
no triangle strips or other cells.
parent f5715893
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@
#include "vtkOBJReader.h"
#include "vtkSTLReader.h"
#include "vtkFloatArray.h"
#include "vtkTriangleFilter.h"
#include "g3log/g3log.hpp"
......@@ -110,7 +111,11 @@ VTKMeshIO::readVtkPolyData(const std::string& filePath)
reader->SetFileName(filePath.c_str());
reader->Update();
vtkPolyData* vtkMesh = reader->GetOutput();
auto triFilter = vtkSmartPointer<vtkTriangleFilter>::New();
triFilter->SetInputData(reader->GetOutput());
triFilter->Update();
vtkPolyData* vtkMesh = triFilter->GetOutput();
return VTKMeshIO::convertVtkPolyDataToSurfaceMesh(vtkMesh);
}
......@@ -275,4 +280,4 @@ VTKMeshIO::copyPointData(vtkPointData* pointData, std::map<std::string, StdVecto
}
}
} // imstk
\ No newline at end of file
} // imstk
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment