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
This commit is contained in:
Andreas Fabri 2013-12-17 14:22:01 +01:00 committed by Laurent Rineau
parent ab7f9d0047
commit fa4697ba59
1 changed files with 10 additions and 0 deletions

View File

@ -140,6 +140,16 @@ namespace internal {
const double& bymax = bbox.ymax(); const double& bymax = bbox.ymax();
const double& bzmax = bbox.zmax(); 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: // The following code encode t1 and t2 by:
// t1 = tmin/dmin // t1 = tmin/dmin
// t2 = tmax/dmax // t2 = tmax/dmax