fix for corefinement demo plugin in case of hand modified polyhedron

In case a polyhedron is modified "by hand", the canonical halfedge
of a pair might be on the boundary. If it's the case, we simply
take the opposite.
Add assertions to check we don't access the facet of a border halfedge

Trivial bug fix for master
This commit is contained in:
Sébastien Loriot 2015-01-16 11:19:32 +01:00
parent 59a7f710dd
commit 2f4ed34a85
2 changed files with 4 additions and 2 deletions

View File

@ -892,7 +892,8 @@ class Intersection_of_Polyhedra_3{
void operator()( const Box* fb, const Box* eb) const { void operator()( const Box* fb, const Box* eb) const {
Halfedge_handle fh = fb->handle(); //handle for the face Halfedge_handle fh = fb->handle(); //handle for the face
Halfedge_handle eh = eb->handle(); //handle for the edge Halfedge_handle eh = eb->handle(); //handle for the edge
if(eh->is_border()) eh = eh->opposite();
CGAL_assertion(!eh->is_border());
//check if the segment intersects the plane of the facet or if it is included in the plane //check if the segment intersects the plane of the facet or if it is included in the plane
const typename Kernel::Point_3 & a = fh->vertex()->point(); const typename Kernel::Point_3 & a = fh->vertex()->point();
@ -906,7 +907,7 @@ class Intersection_of_Polyhedra_3{
return; //no intersection return; //no intersection
} }
//WARNING THIS IS DONE ONLY FOR POLYHEDRON (MAX TWO INCIDENT FACETS TO EDGE) //WARNING THIS IS DONE ONLY FOR POLYHEDRON (MAX TWO INCIDENT FACETS TO EDGE)
if (!eh->is_border() && orientation(a,b,c,eh->next()->vertex()->point())==COPLANAR){ if (/* !eh->is_border() && */ orientation(a,b,c,eh->next()->vertex()->point())==COPLANAR){
coplanar_facets.insert(make_sorted_pair_of_facets(eh->facet(),fh->facet())); coplanar_facets.insert(make_sorted_pair_of_facets(eh->facet(),fh->facet()));
} }
if (!eh->opposite()->is_border() && orientation(a,b,c,eh->opposite()->next()->vertex()->point())==COPLANAR){ if (!eh->opposite()->is_border() && orientation(a,b,c,eh->opposite()->next()->vertex()->point())==COPLANAR){

View File

@ -1373,6 +1373,7 @@ public:
void add_filtered_intersection(Halfedge_handle eh,Halfedge_handle fh,Polyhedron& Pe,Polyhedron& Pf){ void add_filtered_intersection(Halfedge_handle eh,Halfedge_handle fh,Polyhedron& Pe,Polyhedron& Pf){
//use the representant halfedge of the facet as key //use the representant halfedge of the facet as key
//--set polyhedron for the two facets incident to the edge //--set polyhedron for the two facets incident to the edge
CGAL_assertion(!eh->is_border());
hedge_to_polyhedron.insert(std::make_pair(eh->facet()->halfedge(),&Pe)); hedge_to_polyhedron.insert(std::make_pair(eh->facet()->halfedge(),&Pe));
if ( !eh->opposite()->is_border() ) if ( !eh->opposite()->is_border() )
hedge_to_polyhedron.insert(std::make_pair(eh->opposite()->facet()->halfedge(),&Pe)); hedge_to_polyhedron.insert(std::make_pair(eh->opposite()->facet()->halfedge(),&Pe));