diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h index 6206ae33aec..971b7f58347 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h @@ -84,7 +84,6 @@ public: bool has_on_bounded_side(const Point_3& p) const; bool has_on_unbounded_side(const Point_3& p) const; bool is_degenerate() const; - Bbox_3 bbox() const; FT xmin() const; FT ymin() const; FT zmin() const; @@ -380,12 +379,6 @@ Iso_cuboidH3::is_degenerate() const || ( (this->min)().hz() == (this->max)().hz() ) ); } -template < class R > -inline -Bbox_3 -Iso_cuboidH3::bbox() const -{ return (this->min)().bbox() + (this->max)().bbox(); } - template < class R > CGAL_KERNEL_INLINE Iso_cuboidH3 diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h index 7c3e5aeea2b..d8666b62954 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h @@ -25,7 +25,6 @@ #define CGAL_HOMOGENEOUS_POINT_3_H #include -#include #include #include @@ -111,7 +110,6 @@ public: Direction_3 direction() const; Point_3 transform( const Aff_transformation_3 & t) const; - Bbox_3 bbox() const; bool operator==( const PointH3& p) const; bool operator!=( const PointH3& p) const; @@ -230,23 +228,6 @@ typename R::Point_3 PointH3::transform(const typename PointH3::Aff_transformation_3& t) const { return t.transform(static_cast(*this)); } -template < class R > -CGAL_KERNEL_LARGE_INLINE -Bbox_3 -PointH3::bbox() const -{ - Interval_nt<> ihx = CGAL_NTS to_interval(hx()); - Interval_nt<> ihy = CGAL_NTS to_interval(hy()); - Interval_nt<> ihz = CGAL_NTS to_interval(hz()); - Interval_nt<> ihw = CGAL_NTS to_interval(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()); -} - CGAL_END_NAMESPACE #endif // CGAL_HOMOGENEOUS_POINT_3_H diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h index b96fe54f41d..869cce61a13 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h @@ -17,7 +17,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Stefan Schirra @@ -80,8 +80,6 @@ public: SphereH3 opposite() const; - Bbox_3 bbox() const; - Oriented_side oriented_side(const Point_3& p) const; bool @@ -226,31 +224,6 @@ SphereH3::opposite() const CGAL::opposite(orientation()) ); } -template -CGAL_KERNEL_INLINE -Bbox_3 -SphereH3::bbox() const -{ - - Bbox_3 b = 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(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()); -} - CGAL_END_NAMESPACE #endif // CGAL_SPHEREH3_H diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h b/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h index f731081d56e..59c4a3e71fe 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h @@ -1952,6 +1952,88 @@ namespace HomogeneousKernelFunctors { return Bbox_2(minx.inf(), miny.inf(), maxx.sup(), maxy.sup()); } }; + + template + 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 class Construct_bisector_2 {