From ae1923aa2e85d255c48785d767d759e45057acf9 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 22 Feb 2018 17:31:23 +0000 Subject: [PATCH 1/2] Deal with Triangle_Line and Triangle_Ray --- .../Triangle_3_Line_3_intersection.h | 19 +++++------- .../Triangle_3_Ray_3_intersection.h | 31 ++++++------------- .../Triangle_3_Segment_3_intersection.h | 2 +- 3 files changed, 19 insertions(+), 33 deletions(-) diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h index ec6be518665..445057dff57 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h +++ b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h @@ -175,7 +175,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, case NEGATIVE: // c is isolated on the negative side return intersection_return(t3l3_intersection_coplanar_aux(a,b,c,l,true,k)); - case COLLINEAR: + default: // COLLINEAR return intersection_return(c); } @@ -196,7 +196,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, // a is isolated on the positive side (here mb b could be use as // an endpoint instead of computing an intersection) return intersection_return(t3l3_intersection_coplanar_aux(b,c,a,l,false,k)); - case COLLINEAR: + default: // COLLINEAR // b,c,p,q are aligned, [p,q]&[b,c] have the same direction return intersection_return((segment(b,c))); } @@ -229,7 +229,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, // the triangle lies in the negative halfspace // defined by the segment's supporting line. return intersection_return(); - case COLLINEAR: + default: // COLLINEAR return intersection_return(c); } @@ -241,7 +241,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, return intersection_return(t3l3_intersection_coplanar_aux(b,c,a,l,true,k)); case NEGATIVE: return intersection_return(b); - case COLLINEAR: + default: // COLLINEAR // b,c,p,q are aligned, [p,q]&[c,b] have the same direction return intersection_return(segment(c,b)); } @@ -264,7 +264,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, // b is isolated on the positive side (here mb a could be use as // an endpoint instead of computing an intersection) return intersection_return(t3l3_intersection_coplanar_aux(c,a,b,l,false,k)); - case COLLINEAR: + default: // COLLINEAR // a,c,p,q are aligned, [p,q]&[c,a] have the same direction return intersection_return(segment(c,a)); } @@ -277,7 +277,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, return intersection_return(t3l3_intersection_coplanar_aux(c,a,b,l,true,k)); case NEGATIVE: return intersection_return(a); - case COLLINEAR: + default: // COLLINEAR: // a,c,p,q are aligned, [p,q]&[a,c] have the same direction return intersection_return(segment(a,c)); } @@ -290,7 +290,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, case NEGATIVE: // a,b,p,q are aligned, [p,q]&[b,a] have the same direction return intersection_return(segment(b,a)); - case COLLINEAR: + default: // COLLINEAR // case pqc == COLLINEAR is impossible since the triangle is // assumed to be non flat CGAL_error(); @@ -394,12 +394,9 @@ intersection(const typename K::Triangle_3 &t, else return intersection_return(); - case COPLANAR: // pqa or pqb or pqc are collinear + default: // COPLANAR: // pqa or pqb or pqc are collinear return t3l3_intersection_aux(t,l,k); - default: // should not happen. - CGAL_error(); - return intersection_return(); } default: // should not happen. diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h index 3c4f951d3fc..50986780348 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h +++ b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h @@ -234,7 +234,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, // c is isolated on the negative side return t3r3_intersection_coplanar_aux(a,b,c,r,true,k); - case COLLINEAR: + default: // COLLINEAR // p,q,c are collinear if ( collinear_ordered(p,c,q) || collinear_ordered(p,q,c) ) return intersection_return(c); @@ -265,7 +265,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, // an endpoint instead of computing an intersection) return t3r3_intersection_coplanar_aux(b,c,a,r,false,k); - case COLLINEAR: + default: // COLLINEAR // b,c,p,q are aligned, [p,q]&[b,c] have the same direction if ( collinear_ordered(p,b,c) ) return intersection_return(segment(b,c)); @@ -303,7 +303,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, // defined by the segment's supporting line. return intersection_return(); - case COLLINEAR: + default: // COLLINEAR: // p,q,c are collinear if ( collinear_ordered(p,c,q) || collinear_ordered(p,q,c) ) return intersection_return(c); @@ -325,7 +325,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, else return intersection_return(); - case COLLINEAR: + default: // COLLINEAR // b,c,p,q are aligned, [p,q]&[c,b] have the same direction if ( collinear_ordered(p,c,b) ) return intersection_return(segment(c,b)); @@ -357,7 +357,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, // an endpoint instead of computing an intersection) return t3r3_intersection_coplanar_aux(c,a,b,r,false,k); - case COLLINEAR: + default: // COLLINEAR // a,c,p,q are aligned, [p,q]&[c,a] have the same direction if ( collinear_ordered(p,c,a) ) return intersection_return(segment(c,a)); @@ -379,7 +379,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, else return intersection_return(); - case COLLINEAR: + default: // COLLINEAR // a,c,p,q are aligned, [p,q]&[a,c] have the same direction if ( collinear_ordered(p,a,c) ) return intersection_return(segment(a,c)); @@ -403,7 +403,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, else return intersection_return(segment(p,a)); - case COLLINEAR: + default: // COLLINEAR // case pqc == COLLINEAR is impossible since the triangle is // assumed to be non flat CGAL_error(); @@ -498,13 +498,9 @@ intersection(const typename K::Triangle_3 &t, else return intersection_return(); - case COPLANAR: + default: // COPLANAR // The ray lie in a plane parallel to a,b,c support plane return intersection_return(); - - default: // should not happen. - CGAL_error(); - return intersection_return(); } case NEGATIVE: @@ -528,13 +524,10 @@ intersection(const typename K::Triangle_3 &t, // triangle's supporting plane return intersection_return(); - case COPLANAR: + default: // COPLANAR // The ray lie in a plane parallel to a,b,c support plane return intersection_return(); - default: // should not happen. - CGAL_error(); - return intersection_return(); } case COPLANAR: // p belongs to the triangle's supporting plane @@ -565,13 +558,9 @@ intersection(const typename K::Triangle_3 &t, else return intersection_return(); - case COPLANAR: + default: // COPLANAR // The ray lies in the triangle supporting plane return intersection_coplanar(t,r,k); - - default: // should not happen. - CGAL_error(); - return intersection_return(); } default: // should not happen. diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h index 320919e4593..31f9fcf7dcf 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h +++ b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h @@ -257,7 +257,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, case NEGATIVE: // c is isolated on the negative side return t3s3_intersection_coplanar_aux(a,b,c,p,q,true,k); - default: + default: // COLLINEAR if ( collinear_ordered(p,c,q) ) // c is inside [p,q] return intersection_return(c); else From d3027734ca292f98c76b268235d395e115707440 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 23 Feb 2018 19:07:36 +0000 Subject: [PATCH 2/2] fix indentation --- .../Intersections_3/Triangle_3_Line_3_intersection.h | 2 +- .../Intersections_3/Triangle_3_Ray_3_intersection.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h index 445057dff57..a290b1b77d8 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h +++ b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h @@ -175,7 +175,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, case NEGATIVE: // c is isolated on the negative side return intersection_return(t3l3_intersection_coplanar_aux(a,b,c,l,true,k)); - default: // COLLINEAR + default: // COLLINEAR return intersection_return(c); } diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h index 50986780348..bdf8830f627 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h +++ b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h @@ -265,7 +265,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, // an endpoint instead of computing an intersection) return t3r3_intersection_coplanar_aux(b,c,a,r,false,k); - default: // COLLINEAR + default: // COLLINEAR // b,c,p,q are aligned, [p,q]&[b,c] have the same direction if ( collinear_ordered(p,b,c) ) return intersection_return(segment(b,c)); @@ -325,7 +325,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, else return intersection_return(); - default: // COLLINEAR + default: // COLLINEAR // b,c,p,q are aligned, [p,q]&[c,b] have the same direction if ( collinear_ordered(p,c,b) ) return intersection_return(segment(c,b)); @@ -357,7 +357,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, // an endpoint instead of computing an intersection) return t3r3_intersection_coplanar_aux(c,a,b,r,false,k); - default: // COLLINEAR + default: // COLLINEAR // a,c,p,q are aligned, [p,q]&[c,a] have the same direction if ( collinear_ordered(p,c,a) ) return intersection_return(segment(c,a)); @@ -498,7 +498,7 @@ intersection(const typename K::Triangle_3 &t, else return intersection_return(); - default: // COPLANAR + default: // COPLANAR // The ray lie in a plane parallel to a,b,c support plane return intersection_return(); }