setting Has_static_filters for Epeck to true

fixing static filter for Sphere_3 Iso_cuboid_3 intersection
This commit is contained in:
Sven Oesau 2025-11-10 16:40:02 +01:00
parent 6cb3723772
commit b090cd8c22
4 changed files with 14 additions and 39 deletions

View File

@ -774,23 +774,9 @@ public:
// If the center is inside the box, check the distance to the closest box face and the furthest corner.
if (distance == 0) {
double dx = (std::min)(bxmax - scx, scx - bxmin);
double dy = (std::min)(bymax - scy, scy - bymin);
double dz = (std::min)(bzmax - scz, scz - bzmin);
// Distance to closest box face
distance = (std::min)(dx, (std::min)(dy, dz)) - ssr;
if ((distance < 3.33558365626356687717e-147) || (distance > 1.67597599124282407923e+153)) {
CGAL_BRANCH_PROFILER_BRANCH_2(tmp);
return Base::operator()(s, b);
}
eps = 1.99986535548615598560e-15 * (std::max)(ssr, distance);
// Is the sphere fully contained in the box?
if (distance > eps)
return false;
double dx = (std::max)(bxmax - scx, scx - bxmin);
double dy = (std::max)(bymax - scy, scy - bymin);
double dz = (std::max)(bzmax - scz, scz - bzmin);
dx = square(dx);
dy = square(dy);
@ -804,13 +790,14 @@ public:
eps = 1.99986535548615598560e-15 * (std::max)((std::max)(ssr, dx), (std::max)(dy, dz));
double outer_distance = dx + dy + dz - ssr;
distance = dx + dy + dz - ssr;
// Is the box fully contained in the sphere?
if (outer_distance > eps)
if (distance > eps)
return false;
if (distance < eps && outer_distance < eps)
// Does the box intersect the sphere or is the sphere fully contained in the box?
if (distance < -eps)
return true;
}

View File

@ -84,11 +84,7 @@ public:
#ifdef CGAL_NO_STATIC_FILTERS_FOR_LAZY_KERNEL
enum { Has_static_filters = false };
#else
// @fixme, this should be 'true' but it's broken because EPIC_predicate_if_convertible
// assumes the static filtered predicate and the (non-static) filtered predicate
// have the same signature, which is not always the case, for example in
// Do_intersect_3(Sphere_3, Bbox_3, *bool*)
enum { Has_static_filters = false };
enum { Has_static_filters = true };
#endif
// Types

View File

@ -309,20 +309,6 @@ int main(int argc, char **argv)
assert( !CGAL::Epick::Has_static_filters);
#endif
#ifdef CGAL_DONT_USE_LAZY_KERNEL
#ifdef CGAL_NO_STATIC_FILTERS
assert( !CGAL::Epeck::Has_static_filters);
#else
assert( CGAL::Epeck::Has_static_filters);
#endif
#else
#ifdef CGAL_LAZY_KERNEL_USE_STATIC_FILTERS_BY_DEFAULT
assert( CGAL::Epeck::Has_static_filters);
#else
assert( !CGAL::Epeck::Has_static_filters);
#endif
#endif
assert( K2::Has_static_filters);
assert(! K4::Has_static_filters);

View File

@ -82,12 +82,18 @@ do_intersect_sphere_box_3(const typename K::Sphere_3& sphere,
{
d = to_FT(bzmin) - to_FT(center.z());
d = square(d);
if (certainly(d > sr))
return false;
distance += d;
}
else if(compare(center.z(), bzmax) == LARGER)
{
d = to_FT(center.z()) - to_FT(bzmax);
d = square(d);
if (certainly(d > sr))
return false;
distance += d;
}
// Note that with the way the distance above is computed, the distance is '0'