mirror of https://github.com/CGAL/cgal
Move 3D .bbox() to the functors to make Lazy_kernel pass, and enhance the test-suite to test .bbox()
This commit is contained in:
parent
448f38f407
commit
370e6a1695
|
|
@ -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<R>::is_degenerate() const
|
|||
|| ( (this->min)().hz() == (this->max)().hz() ) );
|
||||
}
|
||||
|
||||
template < class R >
|
||||
inline
|
||||
Bbox_3
|
||||
Iso_cuboidH3<R>::bbox() const
|
||||
{ return (this->min)().bbox() + (this->max)().bbox(); }
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
Iso_cuboidH3<R>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#define CGAL_HOMOGENEOUS_POINT_3_H
|
||||
|
||||
#include <CGAL/Origin.h>
|
||||
#include <CGAL/Bbox_3.h>
|
||||
#include <CGAL/Fourtuple.h>
|
||||
#include <CGAL/Kernel/Cartesian_coordinate_iterator_3.h>
|
||||
|
||||
|
|
@ -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<R>& p) const;
|
||||
bool operator!=( const PointH3<R>& p) const;
|
||||
|
|
@ -230,23 +228,6 @@ typename R::Point_3
|
|||
PointH3<R>::transform(const typename PointH3<R>::Aff_transformation_3& t) const
|
||||
{ return t.transform(static_cast<const Point_3&>(*this)); }
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_LARGE_INLINE
|
||||
Bbox_3
|
||||
PointH3<R>::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
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Stefan Schirra
|
||||
|
||||
|
|
@ -80,8 +80,6 @@ public:
|
|||
|
||||
SphereH3<R> opposite() const;
|
||||
|
||||
Bbox_3 bbox() const;
|
||||
|
||||
Oriented_side oriented_side(const Point_3& p) const;
|
||||
|
||||
bool
|
||||
|
|
@ -226,31 +224,6 @@ SphereH3<R>::opposite() const
|
|||
CGAL::opposite(orientation()) );
|
||||
}
|
||||
|
||||
template <class R>
|
||||
CGAL_KERNEL_INLINE
|
||||
Bbox_3
|
||||
SphereH3<R>::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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue