mirror of https://github.com/CGAL/cgal
- exchanged old inefficient bounding_box
- tried to remove some compiler problems
This commit is contained in:
parent
741b1595e5
commit
15720a2aed
|
|
@ -22,291 +22,30 @@
|
|||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Handle_for.h>
|
||||
#include <CGAL/box_intersection_d.h>
|
||||
#include <CGAL/Box_intersection_d/box_limits.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <typename Tag, typename Traits> class Bounding_box_3;
|
||||
|
||||
template <typename Traits>
|
||||
class Bounding_box_rep_3 {
|
||||
class Bounding_box_3 :
|
||||
public Box_intersection_d::Box_d< double, 3> {
|
||||
|
||||
typedef Box_intersection_d::Box_d< double, 3> Base;
|
||||
|
||||
typedef typename Traits::Point_3 Point_3;
|
||||
|
||||
public:
|
||||
Bounding_box_rep_3() {
|
||||
min = Point_3(0,0,0);
|
||||
max = Point_3(0,0,0);
|
||||
}
|
||||
Bounding_box_rep_3(Point_3 init_min, Point_3 init_max) {
|
||||
min = init_min;
|
||||
max = init_max;
|
||||
}
|
||||
|
||||
Point_3 min;
|
||||
Point_3 max;
|
||||
};
|
||||
|
||||
template <typename Traits>
|
||||
class Bounding_box_3<Cartesian_tag,Traits> :
|
||||
public Handle_for< Bounding_box_rep_3<Traits> >
|
||||
{
|
||||
typedef Handle_for< Bounding_box_rep_3<Traits> > BBox_handle_3;
|
||||
typedef typename BBox_handle_3::element_type BBox_ref_3;
|
||||
|
||||
typedef typename Traits::Point_3 Point_3;
|
||||
typedef typename Traits::FT FT;
|
||||
|
||||
public:
|
||||
Bounding_box_3()
|
||||
: BBox_handle_3(BBox_ref_3()) {}
|
||||
Bounding_box_3() : Base() {}
|
||||
|
||||
Bounding_box_3(Point_3 init_min, Point_3 init_max)
|
||||
: BBox_handle_3(BBox_ref_3(init_min, init_max)) {}
|
||||
|
||||
|
||||
const Point_3& get_min() const { return this->Ptr()->min; }
|
||||
const Point_3& get_max() const { return this->Ptr()->max; }
|
||||
|
||||
Bounding_box_3 operator+(const Bounding_box_3& b) const {
|
||||
|
||||
FT xmin = get_min().x() < b.get_min().x() ? get_min().x() : b.get_min().x();
|
||||
FT ymin = get_min().y() < b.get_min().y() ? get_min().y() : b.get_min().y();
|
||||
FT zmin = get_min().z() < b.get_min().z() ? get_min().z() : b.get_min().z();
|
||||
FT xmax = get_max().x() > b.get_max().x() ? get_max().x() : b.get_max().x();
|
||||
FT ymax = get_max().y() > b.get_max().y() ? get_max().y() : b.get_max().y();
|
||||
FT zmax = get_max().z() > b.get_max().z() ? get_max().z() : b.get_max().z();
|
||||
|
||||
return Bounding_box_3(normalized(Point_3(xmin,ymin,zmin)),
|
||||
normalized(Point_3(xmax,ymax,zmax)));
|
||||
void extend( const Point_3& p) {
|
||||
std::pair<double, double> q[3];
|
||||
q[0] = CGAL::to_interval( p.x() );
|
||||
q[1] = CGAL::to_interval( p.y() );
|
||||
q[2] = CGAL::to_interval( p.z() );
|
||||
Box_intersection_d::Box_d< double, 3 >::extend(q);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Traits>
|
||||
class Bounding_box_3<Homogeneous_tag,Traits> :
|
||||
public Handle_for< Bounding_box_rep_3<Traits> >
|
||||
{
|
||||
typedef Handle_for< Bounding_box_rep_3<Traits> > BBox_handle_3;
|
||||
typedef typename BBox_handle_3::element_type BBox_ref_3;
|
||||
|
||||
typedef typename Traits::Point_3 Point_3;
|
||||
typedef typename Traits::Vector_3 Vector_3;
|
||||
|
||||
public:
|
||||
Bounding_box_3()
|
||||
: BBox_handle_3(BBox_ref_3()) {}
|
||||
|
||||
Bounding_box_3(Point_3 init_min, Point_3 init_max)
|
||||
: BBox_handle_3(BBox_ref_3(init_min, init_max)) {}
|
||||
|
||||
|
||||
const Point_3& get_min() const { return this->Ptr()->min; }
|
||||
const Point_3& get_max() const { return this->Ptr()->max; }
|
||||
|
||||
Bounding_box_3 operator+(const Bounding_box_3& b) const {
|
||||
|
||||
Point_3 res_min(b.get_min()), res_max(b.get_max());
|
||||
|
||||
if(res_min.x() > get_min().x()) {
|
||||
Point_3 src(res_min.hx(),0,0,res_min.hw());
|
||||
Point_3 tgt(get_min().hx(),0,0,get_min().hw());
|
||||
Vector_3 delta(tgt - src);
|
||||
res_min = res_min + delta;
|
||||
}
|
||||
if(res_min.y() > get_min().y()) {
|
||||
Point_3 src(0,res_min.hy(),0,res_min.hw());
|
||||
Point_3 tgt(0,get_min().hy(),0,get_min().hw());
|
||||
Vector_3 delta(tgt - src);
|
||||
res_min = res_min + delta;
|
||||
}
|
||||
if(res_min.z() > get_min().z()) {
|
||||
Point_3 src(0,0,res_min.hz(),res_min.hw());
|
||||
Point_3 tgt(0,0,get_min().hz(),get_min().hw());
|
||||
Vector_3 delta(tgt - src);
|
||||
res_min = res_min + delta;
|
||||
}
|
||||
|
||||
if(res_max.x() < get_max().x()) {
|
||||
Point_3 src(res_max.hx(),0,0,res_max.hw());
|
||||
Point_3 tgt(get_max().hx(),0,0,get_max().hw());
|
||||
Vector_3 delta(tgt - src);
|
||||
res_max = res_max + delta;
|
||||
}
|
||||
if(res_max.y() < get_max().y()) {
|
||||
Point_3 src(0,res_max.hy(),0,res_max.hw());
|
||||
Point_3 tgt(0,get_max().hy(),0,get_max().hw());
|
||||
Vector_3 delta(tgt - src);
|
||||
res_max = res_max + delta;
|
||||
}
|
||||
if(res_max.z() < get_max().z()) {
|
||||
Point_3 src(0,0,res_max.hz(),res_max.hw());
|
||||
Point_3 tgt(0,0,get_max().hz(),get_max().hw());
|
||||
Vector_3 delta(tgt - src);
|
||||
res_max = res_max + delta;
|
||||
}
|
||||
|
||||
return Bounding_box_3(normalized(res_min),normalized(res_max));
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
template <typename NT>
|
||||
inline
|
||||
Bounding_box_3<Cartesian_tag,NT>
|
||||
Bounding_box_3<Cartesian_tag,NT>::
|
||||
operator+(const Bounding_box_3<Cartesian_tag,NT>& b) const {
|
||||
|
||||
Point_3 res_min(b.get_min()), res_max(b.get_max());
|
||||
|
||||
if(res_min.x() > get_min().x())
|
||||
res_min = Point_3(res_min.x(),get_min().y(),get_min().z());
|
||||
if(res_min.y() > get_min().y())
|
||||
res_min = Point_3(get_min().x(),res_min.y(),get_min().z());
|
||||
if(res_min.z() > get_min().z())
|
||||
res_min = Point_3(get_min().x(),get_min().y(),res_min.z());
|
||||
|
||||
if(res_max.x() < get_max().x())
|
||||
res_max = Point_3(res_max.x(),get_max().y(),get_max().z());
|
||||
if(res_max.y() < get_max().y())
|
||||
res_max = Point_3(get_max().x(),res_max.y(),get_max().z());
|
||||
if(res_max.z() < get_max().z())
|
||||
res_max = Point_3(get_max().x(),get_max().y(),res_max.z());
|
||||
|
||||
return Bounding_box_3(normalized(res_min),normalized(res_max));
|
||||
}
|
||||
|
||||
template <typename NT>
|
||||
inline
|
||||
Bounding_box_3<Homogeneous_tag,NT>
|
||||
Bounding_box_3<Tag_true,NT>::operator+(const Bounding_box_3<Tag_true,NT>& b) const {
|
||||
|
||||
Point_3 res_min(b.get_min()), res_max(b.get_max());
|
||||
|
||||
if(res_min.x() > get_min().x()) {
|
||||
Point_3 src(res_min.hx(),0,0,res_min.hw());
|
||||
Point_3 tgt(get_min().hx(),0,0,get_min().hw());
|
||||
Vector_3 delta(tgt - src);
|
||||
res_min = res_min + delta;
|
||||
}
|
||||
if(res_min.y() > get_min().y()) {
|
||||
Point_3 src(0,res_min.hy(),0,res_min.hw());
|
||||
Point_3 tgt(0,get_min().hy(),0,get_min().hw());
|
||||
Vector_3 delta(tgt - src);
|
||||
res_min = res_min + delta;
|
||||
}
|
||||
if(res_min.z() > get_min().z()) {
|
||||
Point_3 src(0,0,res_min.hz(),res_min.hw());
|
||||
Point_3 tgt(0,0,get_min().hz(),get_min().hw());
|
||||
Vector_3 delta(tgt - src);
|
||||
res_min = res_min + delta;
|
||||
}
|
||||
|
||||
if(res_max.x() < get_max().x()) {
|
||||
Point_3 src(res_max.hx(),0,0,res_max.hw());
|
||||
Point_3 tgt(get_max().hx(),0,0,get_max().hw());
|
||||
Vector_3 delta(tgt - src);
|
||||
res_max = res_max + delta;
|
||||
}
|
||||
if(res_max.y() < get_max().y()) {
|
||||
Point_3 src(0,res_max.hy(),0,res_max.hw());
|
||||
Point_3 tgt(0,get_max().hy(),0,get_max().hw());
|
||||
Vector_3 delta(tgt - src);
|
||||
res_max = res_max + delta;
|
||||
}
|
||||
if(res_max.z() < get_max().z()) {
|
||||
Point_3 src(0,0,res_max.hz(),res_max.hw());
|
||||
Point_3 tgt(0,0,get_max().hz(),get_max().hw());
|
||||
Vector_3 delta(tgt - src);
|
||||
res_max = res_max + delta;
|
||||
}
|
||||
|
||||
return Bounding_box_3(normalized(res_min),normalized(res_max));
|
||||
}
|
||||
*/
|
||||
|
||||
template <typename Tag,typename NT>
|
||||
inline
|
||||
bool
|
||||
do_overlap(const Bounding_box_3<Tag,NT>& bb1, const Bounding_box_3<Tag,NT>& bb2)
|
||||
{
|
||||
if (bb1.get_max().x() < bb2.get_min().x() ||
|
||||
bb2.get_max().x() < bb1.get_min().x())
|
||||
return false;
|
||||
if (bb1.get_max().y() < bb2.get_min().y() ||
|
||||
bb2.get_max().y() < bb1.get_min().y())
|
||||
return false;
|
||||
if (bb1.get_max().z() < bb2.get_min().z() ||
|
||||
bb2.get_max().z() < bb1.get_min().z())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#define CGAL_NO_ISTREAM_EXTRACT_BOUNDING_BOX_3
|
||||
|
||||
#ifndef CGAL_NO_OSTREAM_INSERT_BOUNDING_BOX_3
|
||||
template <typename Tag,typename NT>
|
||||
inline
|
||||
std::ostream&
|
||||
operator<<(std::ostream &os, const Bounding_box_3<Tag,NT>& b)
|
||||
{
|
||||
switch(os.iword(IO::mode))
|
||||
{
|
||||
case IO::ASCII :
|
||||
return os << b.get_min().hx() << ' ' << b.get_min().hy() << ' '
|
||||
<< b.get_min().hz() << ' ' << b.get_min().hw() << std::endl
|
||||
<< b.get_max().hx() << ' ' << b.get_max().hy() << ' '
|
||||
<< b.get_max().hz() << ' ' << b.get_max().hz();
|
||||
case IO::BINARY :
|
||||
write(os, b.get_min().hx());
|
||||
write(os, b.get_min().hy());
|
||||
write(os, b.get_min().hz());
|
||||
write(os, b.get_min().hw());
|
||||
write(os, b.get_max().hx());
|
||||
write(os, b.get_max().hy());
|
||||
write(os, b.get_max().hz());
|
||||
write(os, b.get_max().hw());
|
||||
return os;
|
||||
default:
|
||||
os << "Bounding_box_3<Tag,NT>((" << b.get_min().hx()
|
||||
<< ", " << b.get_min().hy()
|
||||
<< ", " << b.get_min().hz()
|
||||
<< ", " << b.get_min().hw() << "), (";
|
||||
os << b.get_max().hx()
|
||||
<< ", " << b.get_max().hy()
|
||||
<< ", " << b.get_max().hz()
|
||||
<< ", " << b.get_max().hw() << "))";
|
||||
return os;
|
||||
}
|
||||
}
|
||||
#endif // CGAL_NO_OSTREAM_INSERT_BOUNDING_BOX_3
|
||||
|
||||
#ifndef CGAL_NO_ISTREAM_EXTRACT_BOUNDING_BOX_3
|
||||
template <typename Tag, typename NT>
|
||||
inline
|
||||
std::istream&
|
||||
operator>>(std::istream &is, Bounding_box_3<Tag,NT>& b)
|
||||
{
|
||||
NT xmin, ymin, zmin, xmax, ymax, zmax;
|
||||
|
||||
switch(is.iword(IO::mode))
|
||||
{
|
||||
case IO::ASCII :
|
||||
is >> xmin >> ymin >> xmax >> ymax;
|
||||
break;
|
||||
case IO::BINARY :
|
||||
read(is, xmin);
|
||||
read(is, ymin);
|
||||
read(is, zmin);
|
||||
read(is, xmax);
|
||||
read(is, ymax);
|
||||
read(is, zmax);
|
||||
break;
|
||||
}
|
||||
b = Bounding_box_3<Tag,NT>(xmin, ymin, zmin, xmax, ymax, zmax);
|
||||
return is;
|
||||
}
|
||||
|
||||
#endif // CGAL_NO_ISTREAM_EXTRACT_BOUNDING_BOX_3
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_BOUNDING_BOX_3_H
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 1997-2000 Max-Planck-Institute Saarbruecken (Germany).
|
||||
// Copyright (c) 1997-2000 Max-Planck-Institute Saarbruecken (Germany).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
|
|
@ -388,7 +388,7 @@ public:
|
|||
}
|
||||
|
||||
Side_of_plane sop;
|
||||
Oriented_side side = sop(splitting_plane, splitting_plane.point(), f, depth);
|
||||
Oriented_side side = sop(splitting_plane.point(), f, depth);
|
||||
if( side == ON_NEGATIVE_SIDE || side == ON_ORIENTED_BOUNDARY)
|
||||
left_node->add_facet(f, depth+1);
|
||||
if( side == ON_POSITIVE_SIDE || side == ON_ORIENTED_BOUNDARY)
|
||||
|
|
@ -403,7 +403,7 @@ public:
|
|||
}
|
||||
|
||||
Side_of_plane sop;
|
||||
Oriented_side side = sop(splitting_plane, splitting_plane.point(), e, depth);
|
||||
Oriented_side side = sop(splitting_plane.point(), e, depth);
|
||||
if( side == ON_NEGATIVE_SIDE || side == ON_ORIENTED_BOUNDARY)
|
||||
left_node->add_edge(e, depth+1);
|
||||
if( side == ON_POSITIVE_SIDE || side == ON_ORIENTED_BOUNDARY)
|
||||
|
|
@ -418,7 +418,7 @@ public:
|
|||
}
|
||||
|
||||
Side_of_plane sop;
|
||||
Oriented_side side = sop(splitting_plane, splitting_plane.point(), v, depth);
|
||||
Oriented_side side = sop(splitting_plane.point(), v, depth);
|
||||
if( side == ON_NEGATIVE_SIDE || side == ON_ORIENTED_BOUNDARY)
|
||||
left_node->add_vertex(v, depth+1);
|
||||
if( side == ON_POSITIVE_SIDE || side == ON_ORIENTED_BOUNDARY)
|
||||
|
|
@ -620,10 +620,12 @@ void divide_segment_by_plane( Segment_3 s, Plane_3 pl,
|
|||
// First of all, we need to find out wheather we are working over an extended kernel or on a standard kernel. As precondition we have that ray is oriented in the minus x axis direction. When having an extended kernel, the ray can be subtituted by a segment with the endpoint on the 'intersection' between the ray and the bounding infimaximal box. In the presence of a standard kernel, the intersection is computed with the bounding box with the vertices of the Nef polyhedron.
|
||||
Point_3 p(r.source()), q;
|
||||
Bounding_box_3 b = k.bounding_box;
|
||||
CGAL_NEF_TRACEN("bounding box " << b.get_min() << "->" << b.get_max());
|
||||
int c = (CGAL::abs(vec[0]) > CGAL::abs(vec[1]) ? 0 : 1);
|
||||
c = (CGAL::abs(vec[2]) > CGAL::abs(vec[c]) ? 2 : c);
|
||||
Point_3 pt_on_minus_x_plane = vec[c] < 0 ? b.get_min() : b.get_max();
|
||||
|
||||
Point_3 pt_on_minus_x_plane = vec[c] < 0 ?
|
||||
Point_3(RT(b.min_coord(0)), RT(b.min_coord(1)),RT(b.min_coord(2))) :
|
||||
Point_3(RT(b.max_coord(0)), RT(b.max_coord(1)),RT(b.max_coord(2)));
|
||||
// We compute the intersection between a plane with normal vector in
|
||||
// the minus x direction and located at the minimum point of the bounding box, and the input ray. When the ray does not intersect the bounding volume, there won't be any object hit, so it is safe to construct a segment that simply lay in the unbounded side of the bounding box. This approach is taken instead of somehow (efficiently) report that there was no hit object, in order to mantain a clear interface with the Iterator class.
|
||||
Plane_3 pl_on_minus_x;
|
||||
|
|
@ -829,23 +831,20 @@ typename Object_list::difference_type n_vertices = std::distance(objects.begin()
|
|||
root->add_vertex(v,0);
|
||||
}
|
||||
|
||||
template<typename SNCd>
|
||||
class BBox_updater {
|
||||
SNCd D;
|
||||
Bounding_box_3 b;
|
||||
|
||||
public:
|
||||
BBox_updater(const SNCd& sncd) : D(sncd), b(Point_3(0,0,0),Point_3(0,0,0)) {}
|
||||
BBox_updater() {}
|
||||
|
||||
void pre_visit(const Node*) {}
|
||||
void post_visit(const Node* n) {
|
||||
typename Object_list::const_iterator o;
|
||||
for( o = n->objects().begin(); o != n->objects().end(); ++o) {
|
||||
for( o = n->objects().begin();
|
||||
o != n->objects().end(); ++o) {
|
||||
Vertex_handle v;
|
||||
if( CGAL::assign( v, *o)) {
|
||||
Point_3 p(v->point());
|
||||
b = b + Bounding_box_3(p,p);
|
||||
}
|
||||
if( CGAL::assign( v, *o))
|
||||
b.extend(v->point());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -873,8 +872,7 @@ typename Object_list::difference_type n_vertices = std::distance(objects.begin()
|
|||
if(root != 0)
|
||||
root->transform(t);
|
||||
|
||||
SNC_decorator D;
|
||||
BBox_updater<SNC_decorator> bbup(D);
|
||||
BBox_updater bbup;
|
||||
visit_k3tree(root, bbup);
|
||||
bounding_box = bbup.box();
|
||||
}
|
||||
|
|
@ -1105,7 +1103,7 @@ bool classify_objects(Object_iterator start, Object_iterator end,
|
|||
}
|
||||
}
|
||||
#endif
|
||||
Oriented_side side = sop( partition_plane, point_on_plane, *o, depth);
|
||||
Oriented_side side = sop( point_on_plane, *o, depth);
|
||||
if( side == ON_NEGATIVE_SIDE || side == ON_ORIENTED_BOUNDARY) {
|
||||
*o1 = *o;
|
||||
++o1;
|
||||
|
|
|
|||
|
|
@ -144,15 +144,21 @@ public:
|
|||
#endif
|
||||
|
||||
|
||||
template<typename Depth> Oriented_side operator()( const Plane_3& pl, const Point_3& pop, Object_handle o, Depth depth);
|
||||
template<typename Depth> Oriented_side operator()( const Plane_3& pl, const Point_3& pop, Vertex_handle v, Depth depth);
|
||||
template<typename Depth> Oriented_side operator()( const Plane_3& pl, const Point_3& pop, Halfedge_handle e, Depth depth);
|
||||
template<typename Depth> Oriented_side operator()( const Plane_3& pl, const Point_3& pop, Halffacet_handle f, Depth depth);
|
||||
template<typename Depth> Oriented_side operator()
|
||||
( const Point_3& pop, Object_handle o, Depth depth);
|
||||
template<typename Depth> Oriented_side operator()
|
||||
( const Point_3& pop, Vertex_handle v, Depth depth);
|
||||
template<typename Depth> Oriented_side operator()
|
||||
( const Point_3& pop, Halfedge_handle e, Depth depth);
|
||||
template<typename Depth> Oriented_side operator()
|
||||
( const Point_3& pop, Halffacet_handle f, Depth depth);
|
||||
#ifdef CGAL_NEF3_TRIANGULATE_FACETS
|
||||
template<typename Depth> Oriented_side operator()( const Plane_3& pl, const Point_3& pop, Halffacet_triangle_handle f, Depth depth);
|
||||
template<typename Depth> Oriented_side operator()
|
||||
( const Point_3& pop, Halffacet_triangle_handle f, Depth depth);
|
||||
#endif
|
||||
#ifdef CGAL_NEF3_FACET_WITH_BOX
|
||||
template<typename Depth> Oriented_side operator()( const Plane_3& pl, const Point_3& pop, Partial_facet& f, Depth depth);
|
||||
template<typename Depth> Oriented_side operator()
|
||||
( const Point_3& pop, Partial_facet& f, Depth depth);
|
||||
#endif
|
||||
#ifdef CGAL_NEF_EXPLOIT_REFERENCE_COUNTING
|
||||
bool reference_counted;
|
||||
|
|
@ -190,7 +196,7 @@ public:
|
|||
|
||||
typedef typename Kernel::RT RT;
|
||||
typedef typename Kernel::Kernel_tag Kernel_tag;
|
||||
typedef CGAL::Bounding_box_3<Kernel_tag,Kernel> Bounding_box_3;
|
||||
typedef CGAL::Bounding_box_3<Kernel> Bounding_box_3;
|
||||
|
||||
virtual Bounding_box_3 operator()(const Object_list& o) const;
|
||||
virtual Bounding_box_3 operator()(Object_handle o) const;
|
||||
|
|
@ -238,7 +244,7 @@ public:
|
|||
|
||||
typedef typename Kernel::RT RT;
|
||||
typedef typename Kernel::Kernel_tag Kernel_tag;
|
||||
typedef CGAL::Bounding_box_3<Kernel_tag,Kernel> Bounding_box_3;
|
||||
typedef CGAL::Bounding_box_3<Kernel> Bounding_box_3;
|
||||
|
||||
typedef typename Kernel::Intersect_3 Intersect;
|
||||
typedef CGAL::Objects_bbox<SNC_decorator> Objects_bbox;
|
||||
|
|
@ -257,7 +263,7 @@ template <class SNC_decorator>
|
|||
template <typename Depth>
|
||||
Oriented_side
|
||||
Side_of_plane<SNC_decorator>::operator()
|
||||
( const Plane_3& pl, const Point_3& pop, Object_handle o, Depth depth) {
|
||||
(const Point_3& pop, Object_handle o, Depth depth) {
|
||||
Vertex_handle v;
|
||||
Halfedge_handle e;
|
||||
Halffacet_handle f;
|
||||
|
|
@ -268,18 +274,18 @@ Side_of_plane<SNC_decorator>::operator()
|
|||
Partial_facet pf;
|
||||
#endif
|
||||
if( CGAL::assign( v, o))
|
||||
return (*this)( pl, pop, v, depth);
|
||||
return (*this)(pop, v, depth);
|
||||
else if( CGAL::assign( e, o))
|
||||
return (*this)( pl, pop, e, depth);
|
||||
return (*this)(pop, e, depth);
|
||||
else if( CGAL::assign( f, o))
|
||||
return (*this)( pl, pop, f, depth);
|
||||
return (*this)(pop, f, depth);
|
||||
#ifdef CGAL_NEF3_FACET_WITH_BOX
|
||||
else if( CGAL::assign(pf, o))
|
||||
return (*this)( pl, pop, pf, depth);
|
||||
return (*this)(pop, pf, depth);
|
||||
#endif
|
||||
#ifdef CGAL_NEF3_TRIANGULATE_FACETS
|
||||
else if( CGAL::assign( t, o))
|
||||
return (*this)( pl, pop, t, depth);
|
||||
return (*this)(pop, t, depth);
|
||||
#endif
|
||||
else
|
||||
CGAL_assertion_msg( 0, "wrong handle");
|
||||
|
|
@ -291,7 +297,7 @@ template <class SNC_decorator>
|
|||
template <typename Depth>
|
||||
Oriented_side
|
||||
Side_of_plane<SNC_decorator>::operator()
|
||||
( const Plane_3& pl, const Point_3& pop, Vertex_handle v, Depth depth) {
|
||||
( const Point_3& pop, Vertex_handle v, Depth depth) {
|
||||
Comparison_result cr;
|
||||
#ifdef CGAL_NEF_EXPLOIT_REFERENCE_COUNTING
|
||||
if(reference_counted) {
|
||||
|
|
@ -323,9 +329,6 @@ Side_of_plane<SNC_decorator>::operator()
|
|||
OnSideMap[v] = cr == LARGER ? ON_POSITIVE_SIDE :
|
||||
cr == SMALLER ? ON_NEGATIVE_SIDE : ON_ORIENTED_BOUNDARY;
|
||||
}
|
||||
CGAL_NEF_TRACEN("Side_of_plane " << pl << " (" << v->point() << "): "
|
||||
<< OnSideMap[v] << "," << pl.oriented_side(v->point()));
|
||||
CGAL_assertion(OnSideMap[v] == pl.oriented_side(v->point()));
|
||||
return OnSideMap[v];
|
||||
#ifdef CGAL_NEF_EXPLOIT_REFERENCE_COUNTING
|
||||
}
|
||||
|
|
@ -344,7 +347,7 @@ template <class SNC_decorator>
|
|||
template <typename Depth>
|
||||
Oriented_side
|
||||
Side_of_plane<SNC_decorator>::operator()
|
||||
( const Plane_3& pl, const Point_3& pop, Halfedge_handle e, Depth depth) {
|
||||
( const Point_3& pop, Halfedge_handle e, Depth depth) {
|
||||
Vertex_handle v = e->source();
|
||||
Vertex_handle vt = e->twin()->source();
|
||||
/*
|
||||
|
|
@ -390,8 +393,8 @@ Side_of_plane<SNC_decorator>::operator()
|
|||
Oriented_side src_side = OnSideMap[v];
|
||||
Oriented_side tgt_side = OnSideMap[vt];
|
||||
*/
|
||||
Oriented_side src_side = (*this) (pl, pop, v, depth);
|
||||
Oriented_side tgt_side = (*this) (pl, pop, vt, depth);
|
||||
Oriented_side src_side = (*this) (pop, v, depth);
|
||||
Oriented_side tgt_side = (*this) (pop, vt, depth);
|
||||
if( src_side == tgt_side)
|
||||
return src_side;
|
||||
if( src_side == ON_ORIENTED_BOUNDARY)
|
||||
|
|
@ -406,7 +409,7 @@ template <typename SNC_decorator>
|
|||
template <typename Depth>
|
||||
Oriented_side
|
||||
Side_of_plane<SNC_decorator>::operator()
|
||||
( const Plane_3& pl, const Point_3& pop, Halffacet_triangle_handle t, Depth depth) {
|
||||
( const Point_3& pop, Halffacet_triangle_handle t, Depth depth) {
|
||||
bool on_positive_side = false, on_negative_side = false;
|
||||
Triangle_3 tr(t.get_triangle());
|
||||
for( int i = 0; i < 3; ++i) {
|
||||
|
|
@ -435,9 +438,6 @@ Side_of_plane<SNC_decorator>::operator()
|
|||
break;
|
||||
default: CGAL_assertion_msg(false, "wrong value");
|
||||
}
|
||||
CGAL_NEF_TRACEN("Side_of_plane " << pl << "( " << pop << ")" << pop << ":"
|
||||
<< side << "," << pl.oriented_side(tr[i]));
|
||||
CGAL_assertion(side == pl.oriented_side(tr[i]));
|
||||
#ifdef CGAL_NEF_EXPLOIT_REFERENCE_COUNTING
|
||||
if(reference_counted)
|
||||
OnSideMapRC[&(tr[i].hw())] = side;
|
||||
|
|
@ -478,7 +478,7 @@ template <class SNC_decorator>
|
|||
template <typename Depth>
|
||||
Oriented_side
|
||||
Side_of_plane<SNC_decorator>::operator()
|
||||
( const Plane_3& pl, const Point_3& pop, Partial_facet& pf, Depth depth) {
|
||||
(const Point_3& pop, Partial_facet& pf, Depth depth) {
|
||||
CGAL_assertion_msg(false, "not implemented yet");
|
||||
|
||||
return ON_ORIENTED_BOUNDARY;
|
||||
|
|
@ -489,7 +489,7 @@ template <class SNC_decorator>
|
|||
template <typename Depth>
|
||||
Oriented_side
|
||||
Side_of_plane<SNC_decorator>::operator()
|
||||
( const Plane_3& pl, const Point_3& pop, Halffacet_handle f, Depth depth) {
|
||||
(const Point_3& pop, Halffacet_handle f, Depth depth) {
|
||||
CGAL_assertion( std::distance( f->facet_cycles_begin(), f->facet_cycles_end()) > 0);
|
||||
/*
|
||||
#ifdef CGAL_NEF3_FACET_WITH_BOX
|
||||
|
|
@ -528,7 +528,7 @@ Side_of_plane<SNC_decorator>::operator()
|
|||
Vertex_handle v;
|
||||
do {
|
||||
v = sc->source()->center_vertex();
|
||||
facet_side = (*this) (pl, pop, v, depth);
|
||||
facet_side = (*this) (pop, v, depth);
|
||||
++sc;
|
||||
}
|
||||
while( facet_side == ON_ORIENTED_BOUNDARY && sc != send);
|
||||
|
|
@ -538,7 +538,7 @@ Side_of_plane<SNC_decorator>::operator()
|
|||
Oriented_side point_side;
|
||||
while( sc != send) {
|
||||
v = sc->source()->center_vertex();
|
||||
point_side = (*this) (pl, pop, v, depth);
|
||||
point_side = (*this) (pop, v, depth);
|
||||
++sc;
|
||||
if( point_side == ON_ORIENTED_BOUNDARY)
|
||||
continue;
|
||||
|
|
@ -550,24 +550,22 @@ Side_of_plane<SNC_decorator>::operator()
|
|||
}
|
||||
|
||||
template <class SNC_decorator>
|
||||
Bounding_box_3<typename SNC_decorator::Kernel::Kernel_tag,
|
||||
typename SNC_decorator::Kernel>
|
||||
Bounding_box_3<typename SNC_decorator::Kernel>
|
||||
Objects_bbox<SNC_decorator>::operator()
|
||||
( const Object_list& O) const {
|
||||
Bounding_box_3 b(Point_3(0,0,0),Point_3(0,0,0));
|
||||
Bounding_box_3 b;
|
||||
typename Object_list::const_iterator o;
|
||||
for( o = O.begin(); o != O.end(); ++o) {
|
||||
Vertex_handle v;
|
||||
if( CGAL::assign( v, *o)) {
|
||||
b = b + (*this)(v);
|
||||
b.extend(v->point());
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
template <class SNC_decorator>
|
||||
Bounding_box_3<typename SNC_decorator::Kernel::Kernel_tag,
|
||||
typename SNC_decorator::Kernel>
|
||||
Bounding_box_3<typename SNC_decorator::Kernel>
|
||||
Objects_bbox<SNC_decorator>::operator()
|
||||
(Object_handle o) const {
|
||||
Vertex_handle v;
|
||||
|
|
@ -590,41 +588,39 @@ Objects_bbox<SNC_decorator>::operator()
|
|||
}
|
||||
|
||||
template <class SNC_decorator>
|
||||
Bounding_box_3<typename SNC_decorator::Kernel::Kernel_tag,
|
||||
typename SNC_decorator::Kernel>
|
||||
Bounding_box_3<typename SNC_decorator::Kernel>
|
||||
Objects_bbox<SNC_decorator>::operator()
|
||||
(Vertex_handle v) const {
|
||||
Point_3 p(v->point());
|
||||
return Bounding_box_3(p, p);
|
||||
Bounding_box_3 b;
|
||||
b.extend(v->point());
|
||||
return b;
|
||||
}
|
||||
|
||||
template <class SNC_decorator>
|
||||
Bounding_box_3<typename SNC_decorator::Kernel::Kernel_tag,
|
||||
typename SNC_decorator::Kernel>
|
||||
Bounding_box_3<typename SNC_decorator::Kernel>
|
||||
Objects_bbox<SNC_decorator>::operator()
|
||||
(Halfedge_handle e) const {
|
||||
return (operator()(e->source()) + operator()(e->twin()->source()));
|
||||
Bounding_box_3 b;
|
||||
b.extend(e->source()->point());
|
||||
b.extend(e->twin()->source()->point());
|
||||
return b;
|
||||
}
|
||||
|
||||
template <class SNC_decorator>
|
||||
Bounding_box_3<typename SNC_decorator::Kernel::Kernel_tag,
|
||||
typename SNC_decorator::Kernel>
|
||||
Bounding_box_3<typename SNC_decorator::Kernel>
|
||||
Objects_bbox<SNC_decorator>::operator()
|
||||
(Halffacet_triangle_handle t) const {
|
||||
Bounding_box_3 bbox(Point_3(0,0,0),Point_3(0,0,0));
|
||||
Bounding_box_3 bbox;
|
||||
Triangle_3 tr(t.get_triangle());
|
||||
for( int i = 0; i < 3; ++i) {
|
||||
Point_3 p(tr[i]);
|
||||
bbox = bbox + Bounding_box_3(p,p);
|
||||
}
|
||||
for( int i = 0; i < 3; ++i)
|
||||
bbox.extend(tr[i]);
|
||||
return bbox;
|
||||
}
|
||||
|
||||
template <class SNC_decorator>
|
||||
Bounding_box_3<typename SNC_decorator::Kernel::Kernel_tag,
|
||||
typename SNC_decorator::Kernel>
|
||||
Bounding_box_3<typename SNC_decorator::Kernel>
|
||||
Objects_bbox<SNC_decorator>::operator()
|
||||
(Halffacet_handle f) const { // TODO
|
||||
(Halffacet_handle f) const {
|
||||
CGAL_assertion( f->facet_cycles_begin() != Halffacet_cycle_iterator());
|
||||
Halffacet_cycle_iterator fc(f->facet_cycles_begin());
|
||||
SHalfedge_handle e;
|
||||
|
|
@ -632,12 +628,9 @@ Objects_bbox<SNC_decorator>::operator()
|
|||
e = SHalfedge_handle(fc);
|
||||
SHalfedge_around_facet_circulator sc(e), send(sc);
|
||||
CGAL_assertion( !is_empty_range( sc, send));
|
||||
Bounding_box_3 b(operator()(sc->source()->source()));
|
||||
sc++;
|
||||
while( sc != send) {
|
||||
b = b + operator()(sc->source()->source());
|
||||
sc++;
|
||||
}
|
||||
Bounding_box_3 b;
|
||||
CGAL_For_all( sc, send)
|
||||
b.extend(sc->source()->source()->point());
|
||||
return b;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue