From c291e924424e5671d21265b429b0eebd49e01b6a Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 21 Mar 2012 11:40:29 +0000 Subject: [PATCH] Less tests of sign of expressions Followup to previous commit. I have managed to transform most of the tests to simple comparison of input coordinates. That will ease the writing of static filters. Only six determinant signs have to be exactly determined. --- .../Bbox_3_Segment_3_do_intersect.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Segment_3_do_intersect.h index 3ce8b3efd61..70e4520ef53 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Segment_3_do_intersect.h @@ -258,13 +258,15 @@ namespace internal { CGAL_assertion(dzmax >= 0); // If t1 > tymax/dymax || tymin/dymin > t2, return false. - if( dymax > 0 && dmin > 0 && (dmin*tymax) < (dymax*tmin) ) return false; - if( dymin > 0 && dmax > 0 && (dmax*tymin) > (dymin*tmax) ) return false; + if( py != qy && px != qx) { // dmin > 0, dymax >0, dmax > 0, dymin > 0 + if( (dmin*tymax) < (dymax*tmin) ) return false; // TEST TO FILTER + if( (dmax*tymin) > (dymin*tmax) ) return false; // TEST TO FILTER + } // If tymin/dymin > t1, set t1 = tymin/dymin. if( (px == qx) || // <=> (dmin == 0) ( (py != qy) && // <=> (dymin > 0) - (dmin*tymin) > (dymin*tmin) ) ) + (dmin*tymin) > (dymin*tmin) ) ) // TEST TO FILTER { tmin = tymin; dmin = dymin; @@ -273,7 +275,7 @@ namespace internal { // If tymax/dymax < t2, set t2 = tymax/dymax. if( (px == qx) || // <=> (dmax > 0) ( (py != qy) && // <=> dymax > 0 - (dmax*tymax) < (dymax*tmax) ) ) + (dmax*tymax) < (dymax*tmax) ) ) // TEST TO FILTER { tmax = tymax; dmax = dymax; @@ -285,8 +287,13 @@ namespace internal { // CGAL_assertion((dmax == 0) == (px == qx && py == qy)); // If t1 > tzmax || tzmin > t2, return false. - if( dmin > 0 && dzmax > 0 && (dmin*tzmax) < (dzmax*tmin) ) return false; - if( dmax > 0 && dzmin > 0 && (dmax*tzmin) > (dzmin*tmax) ) return false; + if( (px != qx || + py != qy ) && + (pz != qz) ) // dmin > 0, dmax > 0, dzmax > 0, dzmin > 0 + { + if( (dmin*tzmax) < (dzmax*tmin) ) return false; // TEST TO FILTER + if( (dmax*tzmin) > (dzmin*tmax) ) return false; // TEST TO FILTER + } return true; }