avoid reporting duplicated coplanar face pairs by sorting them in the callback

This commit is contained in:
Sébastien Loriot 2017-07-11 08:38:42 +02:00
parent 9954a41e3f
commit 857f996c3f
2 changed files with 5 additions and 9 deletions

View File

@ -260,13 +260,13 @@ public:
{
if (orientation(a,b,c,get(vpmap, target( next(eh, tm), tm)))==COPLANAR)
{
coplanar_faces.insert(std::make_pair(face(eh, tm), face(fh, tm)));
coplanar_faces.insert(make_sorted_pair(face(eh, tm), face(fh, tm)));
}
if (!is_border(eh_opp, tm) &&
orientation(a,b,c,get(vpmap, target(next(eh_opp, tm),tm)))==COPLANAR)
{
coplanar_faces.insert(std::make_pair(face(eh_opp, tm), face(fh, tm)));
coplanar_faces.insert(make_sorted_pair(face(eh_opp, tm), face(fh, tm)));
}
}
else
@ -281,14 +281,14 @@ public:
if (!is_edge_target_incident_to_face(next(eh, tm), fh) &&
orientation(a,b,c,get(vpmap, target( next(eh, tm), tm)))==COPLANAR)
{
coplanar_faces.insert(std::make_pair(face(eh, tm), face(fh, tm)));
coplanar_faces.insert(make_sorted_pair(face(eh, tm), face(fh, tm)));
}
if (!is_border(eh_opp, tm) &&
!is_edge_target_incident_to_face(next(eh_opp, tm), fh) &&
orientation(a,b,c,get(vpmap, target(next(eh_opp, tm),tm)))==COPLANAR)
{
coplanar_faces.insert(std::make_pair(face(eh_opp, tm), face(fh, tm)));
coplanar_faces.insert(make_sorted_pair(face(eh_opp, tm), face(fh, tm)));
}
}

View File

@ -533,14 +533,10 @@ class Intersection_of_triangle_meshes
typedef std::map<Key,Node_id> Coplanar_node_map;
Coplanar_node_map coplanar_node_map;
BOOST_FOREACH(const Face_pair& face_pair_in, coplanar_faces)
BOOST_FOREACH(const Face_pair& face_pair, coplanar_faces)
{
Face_pair face_pair(face_pair_in);
face_descriptor f1=face_pair.first;
face_descriptor f2=face_pair.second;
if (&tm1 == &tm2)
face_pair=make_sorted_pair(face_pair.first, face_pair.second);
typedef CGAL::Exact_predicates_exact_constructions_kernel EK;
typedef Coplanar_intersection<TriangleMesh, EK> Cpl_inter_pt;