156 bool subdivide( MeshType& _m,
size_t _n ,
const bool _update_points =
true)
165 for (
typename mesh_t::EdgeIter eit = _m.edges_begin(); eit != edgesEnd; ++eit) {
166 const typename MeshType::Point to = _m.point(_m.to_vertex_handle(_m.halfedge_handle(*eit,0)));
167 const typename MeshType::Point from = _m.point(_m.from_vertex_handle(_m.halfedge_handle(*eit,0)));
169 real_t length = (to - from).sqrnorm();
172 if ( length > max_edge_length_squared_ )
173 queue.push( queueElement(*eit,length) );
177 while ( !stop && ! queue.empty() ) {
178 queueElement a = queue.top();
181 if ( a.second < max_edge_length_squared_ ) {
185 const typename MeshType::Point to = _m.point(_m.to_vertex_handle(_m.halfedge_handle(a.first,0)));
186 const typename MeshType::Point from = _m.point(_m.from_vertex_handle(_m.halfedge_handle(a.first,0)));
187 const typename MeshType::Point midpoint =
static_cast<typename MeshType::Point::value_type
>(0.5) * (to + from);
189 const typename MeshType::VertexHandle newVertex = _m.add_vertex(midpoint);
190 _m.split(a.first,newVertex);
192 for (
typename MeshType::VertexOHalfedgeIter voh_it(_m,newVertex); voh_it.is_valid(); ++voh_it) {
193 typename MeshType::EdgeHandle eh = _m.edge_handle(*voh_it);
194 const typename MeshType::Point to = _m.point(_m.to_vertex_handle(*voh_it));
195 const typename MeshType::Point from = _m.point(_m.from_vertex_handle(*voh_it));
196 real_t length = (to - from).sqrnorm();
199 if ( length > max_edge_length_squared_ )
200 queue.push( queueElement(eh,length) );
206#if defined(_DEBUG) || defined(DEBUG)