diff --git a/Mesh_3/doc/Mesh_3/CGAL/Polyhedral_mesh_domain_with_features_3.h b/Mesh_3/doc/Mesh_3/CGAL/Polyhedral_mesh_domain_with_features_3.h index 6dcbf79b788..94655a4caf2 100644 --- a/Mesh_3/doc/Mesh_3/CGAL/Polyhedral_mesh_domain_with_features_3.h +++ b/Mesh_3/doc/Mesh_3/CGAL/Polyhedral_mesh_domain_with_features_3.h @@ -85,6 +85,12 @@ those triangles is a feature edge. */ void detect_features(FT angle_bound=120); + +/*! +Detects border edges of the bounding polyhedron and inserts them as features of the domain. +*/ + void detect_borders(); + /// @} }; /* end Polyhedral_mesh_domain_with_features_3 */ diff --git a/Mesh_3/doc/Mesh_3/fig/remeshing.jpg b/Mesh_3/doc/Mesh_3/fig/remeshing.jpg index b28799551e6..dc91673a495 100644 Binary files a/Mesh_3/doc/Mesh_3/fig/remeshing.jpg and b/Mesh_3/doc/Mesh_3/fig/remeshing.jpg differ diff --git a/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp b/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp index 708738c1679..e5e1c35ede2 100644 --- a/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp +++ b/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp @@ -41,6 +41,7 @@ int main() // Get sharp features domain.detect_features(); + domain.detect_borders(); // Mesh criteria Mesh_criteria criteria(edge_size = 0.025, diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h index 1b8555e55a9..a4d304c81bf 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h @@ -39,8 +39,11 @@ #include #include +#include +#include #include +#include #include #include @@ -127,6 +130,8 @@ public: void detect_features(FT angle_in_degree, Polyhedron& p); void detect_features(FT angle_in_degree = FT(60)) { detect_features(angle_in_degree, polyhedron_); } + void detect_borders(); + private: Polyhedron polyhedron_; @@ -236,6 +241,39 @@ detect_features(FT angle_in_degree, Polyhedron& p) boost::make_transform_iterator(polylines.end(),extractor)); } + +template < typename GT_, typename P_, typename TA_, + typename Tag_, typename E_tag_> +void +Polyhedral_mesh_domain_with_features_3:: +detect_borders() +{ + typedef std::vector Polyline; + typedef std::vectorPolylines; + + Polylines polylines; + Polyline empty; + typedef boost::graph_traits::halfedge_descriptor halfedge_descriptor; + std::set visited; + BOOST_FOREACH(halfedge_descriptor h, halfedges(polyhedron_)){ + if(visited.find(h) == visited.end()){ + if(is_border(h,polyhedron_)){ + polylines.push_back(empty); + Polyline& polyline = polylines.back(); + polyline.push_back(source(h,polyhedron_)->point()); + BOOST_FOREACH(halfedge_descriptor h,halfedges_around_face(h,polyhedron_)){ + polyline.push_back(target(h,polyhedron_)->point()); + visited.insert(h); + } + } else { + visited.insert(h); + } + } + } + this->add_features(polylines.begin(), polylines.end()); +} + + } //namespace CGAL