From fa4697ba59c7cdae02b302c38bc78d364fd82d25 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 17 Dec 2013 14:22:01 +0100 Subject: [PATCH] Add a cheap test, namely if one of the two points of segment or ray is in the bbox make_mesh_3 without mesh optimizer, and criteria only on facets, is 2-4 faster on data sets like fandisk, rocker-arm.off, cheese.off --- .../Intersections_3/Bbox_3_Segment_3_do_intersect.h | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 6bf46c4cc96..78362752733 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 @@ -140,6 +140,16 @@ namespace internal { const double& bymax = bbox.ymax(); const double& bzmax = bbox.zmax(); + + if( ( (px >= bxmin) && (px <= bxmax) && + (py >= bymin) && (py <= bymax) && + (pz >= bzmin) && (pz <= bzmax) ) || + ( (qx >= bxmin) && (qx <= bxmax) && + (qy >= bymin) && (qy <= bymax) && + (qz >= bzmin) && (qz <= bzmax) ) ) { + return true; + } + // The following code encode t1 and t2 by: // t1 = tmin/dmin // t2 = tmax/dmax