6 #include <OpenMesh\Tools\Smoother\JacobiLaplaceSmootherT.hh>
18 OMSmoother(
MeshT *mesh, OpenMesh::VPropHandleT<NormalT> &curvVectorHandle, OpenMesh::VPropHandleT<ScalarT> &curvHandle,
ScalarT gaussF);
25 void computeWeightsAround(
VertexH vertex);
26 OpenMesh::VPropHandleT<PointT> original_positions;
27 OpenMesh::VPropHandleT<NormalT> original_normals;
28 OpenMesh::VPropHandleT<ScalarT> weight;
29 OpenMesh::VPropHandleT<NormalT> weight_direction;
38 class smoother2 :
public OpenMesh::Smoother::JacobiLaplaceSmootherT<MeshT>
47 typedef SmootherT<MeshT>
Base;
51 MeshT::VertexIter v_it, v_end(Base::mesh_.vertices_end());
52 MeshT::EdgeIter e_it, e_end(Base::mesh_.edges_end());
53 MeshT::HalfedgeHandle heh0, heh1, heh2;
54 MeshT::VertexHandle v0, v1;
57 MeshT::Scalar weight, lb(-1.0), ub(1.0);
61 OpenMesh::VPropHandleT<float> vertex_weights_;
62 Base::mesh_.add_property(vertex_weights_);
64 OpenMesh::EPropHandleT<float> edge_weights_;
65 Base::mesh_.add_property(edge_weights_);
67 for (v_it=Base::mesh_.vertices_begin(); v_it!=v_end; ++v_it)
68 Base::mesh_.property(vertex_weights_, v_it) = 0.0;
73 for (e_it=Base::mesh_.edges_begin(); e_it!=e_end; ++e_it)
75 heh0 = Base::mesh_.halfedge_handle(e_it.handle(), 0);
76 heh1 = Base::mesh_.halfedge_handle(e_it.handle(), 1);
77 v0 = Base::mesh_.to_vertex_handle(heh0);
78 v1 = Base::mesh_.to_vertex_handle(heh1);
80 Base::mesh_.property(edge_weights_, e_it) = 1.0;
81 Base::mesh_.property(vertex_weights_, v0) += 1.0;
82 Base::mesh_.property(vertex_weights_, v1) += 1.0;
127 for (v_it=Base::mesh_.vertices_begin(); v_it!=v_end; ++v_it)
129 weight = Base::mesh_.property(vertex_weights_, v_it);
131 Base::mesh_.property(vertex_weights_, v_it) = 1.0 / weight;