52 #include "HoleInfoT.hh"
57 template<
class MeshT >
59 : mesh_(_mesh), filler_(0)
64 template<
class MeshT >
72 template<
class MeshT >
80 mesh_->add_property( boundary_search,
"Boundary search" );
83 typename MeshT::EdgeIter e_it, e_end=mesh_->edges_end();
84 for (e_it=mesh_->edges_begin(); e_it!=e_end; ++e_it) {
85 mesh_->property( boundary_search , *e_it ) =
false;
90 for (e_it=mesh_->edges_begin(); e_it!=e_end; ++e_it) {
93 if ( mesh_->property( boundary_search , *e_it ) )
97 if ( !mesh_->is_boundary(*e_it))
101 typename MeshT::HalfedgeHandle hh = mesh_->halfedge_handle( *e_it, 0 );
102 if ( ! mesh_->is_boundary( hh ) )
103 hh = mesh_->opposite_halfedge_handle( hh );
106 typename MeshT::Point center(0,0,0);
111 typename MeshT::HalfedgeHandle ch = hh;
113 currentHole.push_back( mesh_->edge_handle(ch) );
115 center += mesh_->point( mesh_->from_vertex_handle(ch) );
117 mesh_->property( boundary_search , mesh_->edge_handle(ch) ) =
true;
121 typename MeshT::VertexHandle vh = mesh_->to_vertex_handle(ch);
123 for (
typename MeshT::VertexOHalfedgeIter voh_it(*mesh_,vh); voh_it.is_valid(); ++voh_it)
124 if ( mesh_->is_boundary( *voh_it ) )
128 typename MeshT::HalfedgeHandle op = mesh_->opposite_halfedge_handle( ch );
129 typename MeshT::VertexOHalfedgeIter voh_it(*mesh_,op);
134 ch = mesh_->next_halfedge_handle( ch );
136 }
while ( ch != hh );
139 center /= currentHole.size();
145 for (
unsigned int i=0; i < currentHole.size(); i++){
146 typename MeshT::HalfedgeHandle hh = mesh_->halfedge_handle( currentHole[i], 0 );
148 if ( ! mesh_->is_boundary( hh ) )
149 hh = mesh_->opposite_halfedge_handle( hh );
151 typename MeshT::VertexHandle vh = mesh_->from_vertex_handle(hh);
155 typename MeshT::Point p = mesh_->point( vh );
157 if ( (p - center).norm() < (p + n - center).norm() ){
166 holes_.push_back(currentHole);
169 mesh_->remove_property( boundary_search);
174 template<
class MeshT >
178 if ( (uint) _index > holes_.size()){
179 std::cerr <<
"Cannot fill hole. Index invalid." << std::endl;
186 filler_->fill_hole( holes_[_index][0], _stages );
188 mesh_->garbage_collection();
190 MeshSelection::clearEdgeSelection(mesh_);
192 mesh_->update_normals();
196 template<
class MeshT >
202 filler_->fill_hole( _eh, _stages );
204 mesh_->garbage_collection();
206 MeshSelection::clearEdgeSelection(mesh_);
208 mesh_->update_normals();
212 template<
class MeshT >
219 filler_->fill_all_holes( _stages );
224 template<
class MeshT >
228 if ( (uint) _index > holes_.size()){
229 std::cerr <<
"Cannot select hole. Index invalid." << std::endl;
233 for ( uint i = 0 ; i < (holes_[_index]).size() ; ++i ) {
234 mesh_->status( (holes_[_index])[i] ).set_selected(
true);
240 template<
class MeshT >
void selectHole(int _index)
select a hole with given index
HoleInfo(MeshT *_mesh)
Constructor.
std::vector< std::vector< typename MeshT::EdgeHandle > > * holes()
get the holes vector
void fillAllHoles(int _stages=3)
fill all holes of the mesh
void getHoles()
get all holes and store them internally
Add normals to mesh item (vertices/faces)
Functions for selection on a mesh.
void fillHole(int _index, int _stages=3)
fill hole with given index