Move 3D .bbox() to the functors to make Lazy_kernel pass, and enhance the test-suite to test .bbox()
This commit is contained in:
@@ -1952,6 +1952,88 @@ namespace HomogeneousKernelFunctors {
|
||||
return Bbox_2(minx.inf(), miny.inf(), maxx.sup(), maxy.sup()); }
|
||||
};
|
||||
|
||||
|
||||
template <typename K>
|
||||
class Construct_bbox_3
|
||||
{
|
||||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Segment_3 Segment_3;
|
||||
typedef typename K::Triangle_3 Triangle_3;
|
||||
typedef typename K::Tetrahedron_3 Tetrahedron_3;
|
||||
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
|
||||
typedef typename K::Sphere_3 Sphere_3;
|
||||
public:
|
||||
typedef Bbox_3 result_type;
|
||||
typedef Arity_tag< 1 > Arity;
|
||||
|
||||
Bbox_3
|
||||
operator()(const Point_3& p) const
|
||||
{
|
||||
Interval_nt<> ihx = CGAL_NTS to_interval(p.hx());
|
||||
Interval_nt<> ihy = CGAL_NTS to_interval(p.hy());
|
||||
Interval_nt<> ihz = CGAL_NTS to_interval(p.hz());
|
||||
Interval_nt<> ihw = CGAL_NTS to_interval(p.hw());
|
||||
|
||||
Interval_nt<> ix = ihx/ihw;
|
||||
Interval_nt<> iy = ihy/ihw;
|
||||
Interval_nt<> iz = ihz/ihw;
|
||||
|
||||
return Bbox_3(ix.inf(), iy.inf(), iz.inf(),
|
||||
ix.sup(), iy.sup(), iz.sup());
|
||||
}
|
||||
|
||||
Bbox_3
|
||||
operator()(const Segment_3& s) const
|
||||
{ return s.source().bbox() + s.target().bbox(); }
|
||||
|
||||
Bbox_3
|
||||
operator()(const Triangle_3& t) const
|
||||
{
|
||||
typename K::Construct_bbox_3 construct_bbox;
|
||||
return construct_bbox(t.vertex(0))
|
||||
+ construct_bbox(t.vertex(1))
|
||||
+ construct_bbox(t.vertex(2));
|
||||
}
|
||||
|
||||
Bbox_3
|
||||
operator()(const Iso_cuboid_3& r) const
|
||||
{
|
||||
typename K::Construct_bbox_3 construct_bbox;
|
||||
return construct_bbox((r.min)()) + construct_bbox((r.max)());
|
||||
}
|
||||
|
||||
Bbox_3
|
||||
operator()(const Tetrahedron_3& t) const
|
||||
{
|
||||
typename K::Construct_bbox_3 construct_bbox_3;
|
||||
return construct_bbox_3(t.vertex(0)) + construct_bbox_3(t.vertex(1))
|
||||
+ construct_bbox_3(t.vertex(2)) + construct_bbox_3(t.vertex(3));
|
||||
}
|
||||
|
||||
Bbox_3
|
||||
operator()(const Sphere_3& s) const
|
||||
{
|
||||
Bbox_3 b = s.center().bbox();
|
||||
|
||||
Interval_nt<> x (b.xmin(), b.xmax());
|
||||
Interval_nt<> y (b.ymin(), b.ymax());
|
||||
Interval_nt<> z (b.zmin(), b.zmax());
|
||||
|
||||
Interval_nt<> sqr = CGAL_NTS to_interval(s.squared_radius());
|
||||
Interval_nt<> r = CGAL::sqrt(sqr);
|
||||
Interval_nt<> minx = x-r;
|
||||
Interval_nt<> maxx = x+r;
|
||||
Interval_nt<> miny = y-r;
|
||||
Interval_nt<> maxy = y+r;
|
||||
Interval_nt<> minz = z-r;
|
||||
Interval_nt<> maxz = z+r;
|
||||
|
||||
return Bbox_3(minx.inf(), miny.inf(), minz.inf(),
|
||||
maxx.sup(), maxy.sup(), maxz.sup());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename K>
|
||||
class Construct_bisector_2
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user