moved on_bounded_side check into Has_on_bounded_side_2/3

added static filter for Sphere_3 and Iso_cuboid_3
This commit is contained in:
Sven Oesau
2026-01-21 16:01:56 +01:00
parent 6003f957d4
commit 74867a472f
8 changed files with 295 additions and 94 deletions
@@ -3548,12 +3548,22 @@ namespace CommonKernelFunctors {
typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
typedef typename K::Circle_2 Circle_2;
typedef typename K::Triangle_2 Triangle_2;
typedef typename K::Segment_2 Segment_2;
public:
Boolean
operator()( const Circle_2& c, const Point_2& p) const
{ return c.has_on_bounded_side(p); }
Boolean
operator()(const Circle_2& c, const Segment_2& s) const
{
if ((c.center() - s.source()).squared_length() > c.squared_radius())
return false;
return (c.center() - s.target()).squared_length() <= c.squared_radius();
}
Boolean
operator()( const Triangle_2& t, const Point_2& p) const
{ return t.has_on_bounded_side(p); }
@@ -3578,6 +3588,42 @@ namespace CommonKernelFunctors {
operator()( const Sphere_3& s, const Point_3& p) const
{ return s.has_on_bounded_side(p); }
Boolean
operator()(const Sphere_3& s, const Iso_cuboid_3& c) const
{
typedef typename K::FT FT;
FT d = FT(0);
FT distance = FT(0);
const Point_3& center = s.center();
// x
d = (std::max)(square(center.x() - c.xmin()), square(center.x() - c.xmax()));
if (certainly(d > s.squared_radius()))
return false;
distance = d;
// y
d = (std::max)(square(center.y() - c.ymin()), square(center.y() - c.ymax()));
if (certainly(d > s.squared_radius()))
return false;
distance += d;
// z
d = (std::max)(square(center.z() - c.zmin()), square(center.z() - c.zmax()));
if (certainly(d > s.squared_radius()))
return false;
distance += d;
return (distance <= s.squared_radius());
}
Boolean
operator()( const Tetrahedron_3& t, const Point_3& p) const
{ return t.rep().has_on_bounded_side(p); }