44 #ifndef SMOOTH_MESH_HH
45 #define SMOOTH_MESH_HH
49 #include <OpenMesh/Core/Utils/Property.hh>
55 template <
class _Mesh,
class _PropertyHandle>
56 void smooth_mesh_property(
unsigned int _n_iters, _Mesh& _m, _PropertyHandle _pph)
58 typedef typename _PropertyHandle::Value Value;
60 std::vector<Value> temp_values(_m.n_vertices());
62 for (
unsigned int i=0; i < _n_iters; ++i)
64 for (
typename _Mesh::ConstVertexIter cv_it = _m.vertices_begin();
65 cv_it != _m.vertices_end(); ++cv_it)
67 unsigned int valence = 0;
69 Value& temp_value = temp_values[cv_it->idx()];
71 temp_value.vectorize(0);
73 for (
typename _Mesh::ConstVertexVertexIter cvv_it = _m.cvv_iter(cv_it);
76 temp_value += _m.property(_pph,cvv_it);
81 temp_value *= (
typename Value::value_type)(1.0 / valence);
85 temp_value = _m.property(_pph, cv_it);
89 for (
typename _Mesh::ConstVertexIter cv_it = _m.vertices_begin();
90 cv_it != _m.vertices_end(); ++cv_it)
92 _m.property(_pph,cv_it) = temp_values[cv_it->idx()];
97 template <
class _Mesh>
98 void smooth_mesh(_Mesh& _m, uint _n_iters)
100 smooth_mesh_property(_n_iters, _m, _m.points_pph());
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59