mirror of https://github.com/CGAL/cgal
bbox() now uses to_interval
This commit is contained in:
parent
d3a092e9f6
commit
41c49e1d8c
|
|
@ -156,9 +156,9 @@ CGAL_KERNEL_INLINE
|
|||
Bbox_2
|
||||
PointC2<R>::bbox() const
|
||||
{
|
||||
double bx = CGAL::to_double(x());
|
||||
double by = CGAL::to_double(y());
|
||||
return Bbox_2(bx,by, bx,by);
|
||||
std::pair<double,double> xp = CGAL::to_interval(x());
|
||||
std::pair<double,double> yp = CGAL::to_interval(y());
|
||||
return Bbox_2(xp.first, yp.first, xp.second, yp.second);
|
||||
}
|
||||
|
||||
#ifndef CGAL_NO_OSTREAM_INSERT_POINTC2
|
||||
|
|
|
|||
|
|
@ -170,11 +170,10 @@ template < class R >
|
|||
Bbox_3
|
||||
PointC3<R>::bbox() const
|
||||
{
|
||||
// FIXME: to_interval
|
||||
double bx = CGAL::to_double(x());
|
||||
double by = CGAL::to_double(y());
|
||||
double bz = CGAL::to_double(z());
|
||||
return Bbox_3(bx, by, bz, bx, by, bz);
|
||||
std::pair<double,double> xp = CGAL::to_interval(x());
|
||||
std::pair<double,double> yp = CGAL::to_interval(y());
|
||||
std::pair<double,double> zp = CGAL::to_interval(z());
|
||||
return Bbox_3(xp.first, yp.first, zp.first, xp.second, yp.second, zp.second);
|
||||
}
|
||||
|
||||
#ifndef CGAL_CARTESIAN_NO_OSTREAM_INSERT_POINTC3
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#define CGAL_CARTESIAN_SPHERE_3_H
|
||||
|
||||
#include <CGAL/utility.h>
|
||||
#include <CGAL/Interval_arithmetic.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -279,14 +280,23 @@ template < class R >
|
|||
CGAL_KERNEL_INLINE
|
||||
Bbox_3
|
||||
SphereC3<R>::bbox() const
|
||||
{
|
||||
double cx = CGAL::to_double(center().x());
|
||||
double cy = CGAL::to_double(center().y());
|
||||
double cz = CGAL::to_double(center().z());
|
||||
double radius = CGAL::sqrt(CGAL::to_double(squared_radius()));
|
||||
{
|
||||
Bbox_3 b = center().bbox();
|
||||
|
||||
return Bbox_3(cx - radius, cy - radius, cz - radius,
|
||||
cx + radius, cy + radius, cz + radius);
|
||||
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::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());
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue