mirror of https://github.com/CGAL/cgal
Add protection of border edges
This commit is contained in:
parent
6e7c567cdb
commit
7f3d561fee
|
|
@ -85,6 +85,12 @@ those triangles is a feature edge.
|
||||||
*/
|
*/
|
||||||
void detect_features(FT angle_bound=120);
|
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 */
|
}; /* end Polyhedral_mesh_domain_with_features_3 */
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 114 KiB |
|
|
@ -41,6 +41,7 @@ int main()
|
||||||
|
|
||||||
// Get sharp features
|
// Get sharp features
|
||||||
domain.detect_features();
|
domain.detect_features();
|
||||||
|
domain.detect_borders();
|
||||||
|
|
||||||
// Mesh criteria
|
// Mesh criteria
|
||||||
Mesh_criteria criteria(edge_size = 0.025,
|
Mesh_criteria criteria(edge_size = 0.025,
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,11 @@
|
||||||
|
|
||||||
#include <CGAL/enum.h>
|
#include <CGAL/enum.h>
|
||||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||||
|
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||||
|
#include <CGAL/boost/graph/helpers.h>
|
||||||
|
|
||||||
#include <boost/iterator/transform_iterator.hpp>
|
#include <boost/iterator/transform_iterator.hpp>
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
@ -127,6 +130,8 @@ public:
|
||||||
void detect_features(FT angle_in_degree, Polyhedron& p);
|
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_features(FT angle_in_degree = FT(60)) { detect_features(angle_in_degree, polyhedron_); }
|
||||||
|
|
||||||
|
void detect_borders();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Polyhedron polyhedron_;
|
Polyhedron polyhedron_;
|
||||||
|
|
||||||
|
|
@ -236,6 +241,39 @@ detect_features(FT angle_in_degree, Polyhedron& p)
|
||||||
boost::make_transform_iterator(polylines.end(),extractor));
|
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<GT_,P_,TA_,Tag_,E_tag_>::
|
||||||
|
detect_borders()
|
||||||
|
{
|
||||||
|
typedef std::vector<Point_3> Polyline;
|
||||||
|
typedef std::vector<Polyline>Polylines;
|
||||||
|
|
||||||
|
Polylines polylines;
|
||||||
|
Polyline empty;
|
||||||
|
typedef boost::graph_traits<Polyhedron>::halfedge_descriptor halfedge_descriptor;
|
||||||
|
std::set<halfedge_descriptor> 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
|
} //namespace CGAL
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue