7 #include "imstkQuadricDecimate.h" 8 #include "imstkSurfaceMesh.h" 9 #include "imstkLogger.h" 10 #include "imstkGeometryUtilities.h" 12 #include <vtkQuadricDecimation.h> 16 QuadricDecimate::QuadricDecimate() :
17 m_VolumePreserving(true), m_TargetReduction(0.6)
19 setRequiredInputType<SurfaceMesh>(0);
23 setOutput(std::make_shared<SurfaceMesh>());
35 std::shared_ptr<SurfaceMesh> inputMesh = std::dynamic_pointer_cast<
SurfaceMesh>(
getInput(0));
36 if (inputMesh ==
nullptr)
38 LOG(WARNING) <<
"No inputMesh to clean";
43 vtkNew<vtkQuadricDecimation> filter;
44 filter->SetInputData(inputMeshVtk);
45 filter->SetVolumePreservation(m_VolumePreserving);
46 filter->SetTargetReduction(m_TargetReduction);
void setInputMesh(std::shared_ptr< SurfaceMesh > inputMesh)
Required input, port 0.
vtkSmartPointer< vtkPolyData > copyToVtkPolyData(std::shared_ptr< LineMesh > imstkMesh)
Converts imstk line mesh into a vtk polydata.
std::shared_ptr< Geometry > getInput(size_t port=0) const
Returns input geometry given port, returns nullptr if doesn't exist.
void requestUpdate() override
Users can implement this for the logic to be run.
void setNumOutputPorts(const size_t numPorts)
Get/Set the amount of output ports.
void setInput(std::shared_ptr< Geometry > inputGeometry, size_t port=0)
Set the input at the port.
Represents a set of triangles & vertices via an array of Vec3d double vertices & Vec3i integer indice...
std::shared_ptr< SurfaceMesh > copyToSurfaceMesh(vtkSmartPointer< vtkPolyData > vtkMesh)
Converts vtk polydata into a imstk surface mesh.
void setOutput(std::shared_ptr< Geometry > inputGeometry, const size_t port=0)
Set the output at the port.
void setNumInputPorts(const size_t numPorts)
Get/Set the amount of input ports.