From d3a092e9f65134f1d538ac054fe09dc1a8bb5cce Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 2 Jun 2003 14:05:16 +0000 Subject: [PATCH] bbox() now use to_interval --- .../include/CGAL/Cartesian/Circle_2.h | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Packages/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h b/Packages/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h index 64f11f0cb28..3265354311c 100644 --- a/Packages/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h +++ b/Packages/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h @@ -23,6 +23,7 @@ #define CGAL_CARTESIAN_CIRCLE_2_H #include +#include #include CGAL_BEGIN_NAMESPACE @@ -231,14 +232,21 @@ CircleC2::opposite() const template < class R > CGAL_KERNEL_INLINE Bbox_2 -CircleC2::bbox() const // FIXME : to_interval() +CircleC2::bbox() const { - // Robustness problems. - double cx = CGAL::to_double(center().x()); - double cy = CGAL::to_double(center().y()); - double radius = CGAL::sqrt(CGAL::to_double(squared_radius())); + Bbox_2 b = center().bbox(); - return Bbox_2(cx - radius, cy - radius, cx + radius, cy + radius); + Interval_nt<> x (b.xmin(), b.xmax()); + Interval_nt<> y (b.ymin(), b.ymax()); + + Interval_nt<> sqr = CGAL::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; + + return Bbox_2(minx.inf(), miny.inf(), maxx.sup(), maxy.sup()); } template < class R >