7 #include "imstkSurfaceMeshSmoothen.h" 8 #include "imstkGeometryUtilities.h" 9 #include "imstkLogger.h" 10 #include "imstkSurfaceMesh.h" 12 #include <vtkSmoothPolyDataFilter.h> 16 SurfaceMeshSmoothen::SurfaceMeshSmoothen()
19 setRequiredInputType<SurfaceMesh>(0);
22 setOutput(std::make_shared<SurfaceMesh>());
34 std::shared_ptr<SurfaceMesh> inputMesh = std::dynamic_pointer_cast<
SurfaceMesh>(
getInput(0));
35 if (inputMesh ==
nullptr)
37 LOG(WARNING) <<
"No inputMesh to smoothen";
41 vtkNew<vtkSmoothPolyDataFilter> filter;
43 filter->SetNumberOfIterations(m_NumberOfIterations);
44 filter->SetRelaxationFactor(m_RelaxationFactor);
45 filter->SetConvergence(m_Convergence);
46 filter->SetFeatureAngle(m_FeatureAngle);
47 filter->SetEdgeAngle(m_EdgeAngle);
48 filter->SetFeatureEdgeSmoothing(m_FeatureEdgeSmoothing);
49 filter->SetBoundarySmoothing(m_BoundarySmoothing);
void requestUpdate() override
Users can implement this for the logic to be run.
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 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 setInputMesh(std::shared_ptr< SurfaceMesh > inputMesh)
Required input, port 0.
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.