54#define OPENMESH_LAPLACE_SMOOTHERT_C
72LaplaceSmootherT<Mesh>::
73LaplaceSmootherT(Mesh& _mesh)
74 : SmootherT<Mesh>(_mesh)
77 Base::mesh_.add_property(vertex_weights_);
78 Base::mesh_.add_property(edge_weights_);
86LaplaceSmootherT<Mesh>::
90 Base::mesh_.remove_property(vertex_weights_);
91 Base::mesh_.remove_property(edge_weights_);
100LaplaceSmootherT<Mesh>::
101initialize(Component _comp, Continuity _cont)
103 SmootherT<Mesh>::initialize(_comp, _cont);
108 case Base::Tangential:
109 compute_weights(UniformWeighting);
114 compute_weights(CotWeighting);
118 case Base::Tangential_and_Normal:
119 compute_weights(UniformWeighting);
130LaplaceSmootherT<Mesh>::
131compute_weights(LaplaceWeighting _weighting)
143 for (v_it=Base::mesh_.vertices_begin(); v_it!=v_end; ++v_it)
144 Base::mesh_.property(vertex_weights_, *v_it) = 0.0;
151 case UniformWeighting:
153 for (e_it=Base::mesh_.edges_begin(); e_it!=e_end; ++e_it)
155 heh0 = Base::mesh_.halfedge_handle(*e_it, 0);
156 heh1 = Base::mesh_.halfedge_handle(*e_it, 1);
157 v0 = Base::mesh_.to_vertex_handle(heh0);
158 v1 = Base::mesh_.to_vertex_handle(heh1);
160 Base::mesh_.property(edge_weights_, *e_it) = 1.0;
161 Base::mesh_.property(vertex_weights_, v0) += 1.0;
162 Base::mesh_.property(vertex_weights_, v1) += 1.0;
172 for (e_it=Base::mesh_.edges_begin(); e_it!=e_end; ++e_it)
178 heh0 = Base::mesh_.halfedge_handle(*e_it, 0);
179 v0 = Base::mesh_.to_vertex_handle(heh0);
180 p0 = &Base::mesh_.point(v0);
182 heh1 = Base::mesh_.halfedge_handle(*e_it, 1);
183 v1 = Base::mesh_.to_vertex_handle(heh1);
184 p1 = &Base::mesh_.point(v1);
186 heh2 = Base::mesh_.next_halfedge_handle(heh0);
187 p2 = &Base::mesh_.point(Base::mesh_.to_vertex_handle(heh2));
190 weight +=
static_cast<typename
Mesh::Scalar>(1.0) / tan(acos(std::max(lb, std::min(ub,
dot(d0,d1) ))));
192 heh2 = Base::mesh_.next_halfedge_handle(heh1);
193 p2 = &Base::mesh_.point(Base::mesh_.to_vertex_handle(heh2));
196 weight +=
static_cast<typename
Mesh::Scalar>(1.0) / tan(acos(std::max(lb, std::min(ub,
dot(d0,d1) ))));
198 Base::mesh_.property(edge_weights_, *e_it) = weight;
199 Base::mesh_.property(vertex_weights_, v0) += weight;
200 Base::mesh_.property(vertex_weights_, v1) += weight;
210 for (v_it=Base::mesh_.vertices_begin(); v_it!=v_end; ++v_it)
212 weight = Base::mesh_.property(vertex_weights_, *v_it);
214 Base::mesh_.property(vertex_weights_, *v_it) =
static_cast<typename
Mesh::Scalar>(1.0) / weight;
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
@ Normal
Add normals to mesh item (vertices/faces)
Definition: Attributes.hh:82
VectorT< Scalar, DIM > & normalize(VectorT< Scalar, DIM > &_v)
non-member normalize
Definition: Vector11T.hh:769
Scalar dot(const VectorT< Scalar, DIM > &_v1, const VectorT< Scalar, DIM > &_v2)
symmetric version of the dot product
Definition: Vector11T.hh:725
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:136
Kernel::Scalar Scalar
Scalar type.
Definition: PolyMeshT.hh:110
Kernel::Normal Normal
Normal type.
Definition: PolyMeshT.hh:114
Kernel::HalfedgeHandle HalfedgeHandle
Scalar type.
Definition: PolyMeshT.hh:137
Kernel::EdgeIter EdgeIter
Scalar type.
Definition: PolyMeshT.hh:145
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:112
Kernel::VertexIter VertexIter
Scalar type.
Definition: PolyMeshT.hh:143