150 bool subdivide( MeshType& _m,
size_t _n ,
const bool _update_points =
true)
159 for (
typename mesh_t::EdgeIter eit = _m.edges_begin(); eit != edgesEnd; ++eit) {
160 const typename MeshType::Point to = _m.point(_m.to_vertex_handle(_m.halfedge_handle(*eit,0)));
161 const typename MeshType::Point from = _m.point(_m.from_vertex_handle(_m.halfedge_handle(*eit,0)));
163 real_t length =
sqrnorm(to - from);
166 if ( length > max_edge_length_squared_ )
167 queue.push( queueElement(*eit,length) );
171 while ( !stop && ! queue.empty() ) {
172 queueElement a = queue.top();
175 if ( a.second < max_edge_length_squared_ ) {
179 const typename MeshType::Point to = _m.point(_m.to_vertex_handle(_m.halfedge_handle(a.first,0)));
180 const typename MeshType::Point from = _m.point(_m.from_vertex_handle(_m.halfedge_handle(a.first,0)));
181 const typename MeshType::Point midpoint =
static_cast<typename MeshType::Point::value_type
>(0.5) * (to + from);
183 const typename MeshType::VertexHandle newVertex = _m.add_vertex(midpoint);
184 _m.split(a.first,newVertex);
186 for (
typename MeshType::VertexOHalfedgeIter voh_it(_m,newVertex); voh_it.is_valid(); ++voh_it) {
187 typename MeshType::EdgeHandle eh = _m.edge_handle(*voh_it);
188 const typename MeshType::Point to = _m.point(_m.to_vertex_handle(*voh_it));
189 const typename MeshType::Point from = _m.point(_m.from_vertex_handle(*voh_it));
190 real_t length =
sqrnorm(to - from);
193 if ( length > max_edge_length_squared_ )
194 queue.push( queueElement(eh,length) );
200#if defined(_DEBUG) || defined(DEBUG)