Merge pull request #6424 from GilesBathgate/Nef_3-cleanup_snc_intersection-GilesBathgate

Nef_3: Cleanup and performance improvements SNC_intersection
This commit is contained in:
Sébastien Loriot 2022-03-29 17:46:56 +02:00
commit 2067913940
7 changed files with 107 additions and 245 deletions

View File

@ -81,7 +81,6 @@ class Ray_hit_generator : public Modifier_base<typename Nef_::SNC_and_PL> {
}
Point_3 ip;
SNC_intersection I;
SNC_constructor C(*sncp);
Halfedge_handle e;
@ -89,7 +88,7 @@ class Ray_hit_generator : public Modifier_base<typename Nef_::SNC_and_PL> {
CGAL_NEF_TRACEN( "Found edge " << e->source()->point()
<< "->" << e->twin()->source()->point() );
Segment_3 seg(e->source()->point(), e->twin()->source()->point());
I.does_intersect_internally(r, seg, ip);
SNC_intersection::does_intersect_internally(r, seg, ip);
ip = normalized(ip);
v = C.create_from_edge(e,ip);
pl->add_vertex(v);
@ -135,7 +134,7 @@ class Ray_hit_generator : public Modifier_base<typename Nef_::SNC_and_PL> {
Halffacet_handle f;
if(assign(f, o)) {
CGAL_NEF_TRACEN( "Found facet " );
I.does_intersect_internally(r, f, ip);
SNC_intersection::does_intersect_internally(r, f, ip);
ip = normalized(ip);
v = C.create_from_facet(f,ip);
pl->add_vertex(v);

View File

@ -87,7 +87,6 @@ class Ray_hit_generator2 : public Modifier_base<typename Nef_::SNC_and_PL> {
}
Point_3 ip;
SNC_intersection I;
SNC_constructor C(*sncp);
Halfedge_handle e;
@ -95,7 +94,7 @@ class Ray_hit_generator2 : public Modifier_base<typename Nef_::SNC_and_PL> {
CGAL_NEF_TRACEN("Found edge " << e->source()->point()
<< "->" << e->twin()->source()->point());
Segment_3 seg(e->source()->point(), e->twin()->source()->point());
I.does_intersect_internally(r, seg, ip);
SNC_intersection::does_intersect_internally(r, seg, ip);
ip = normalized(ip);
v = C.create_from_edge(e,ip);
pl->add_vertex(v);
@ -147,7 +146,7 @@ class Ray_hit_generator2 : public Modifier_base<typename Nef_::SNC_and_PL> {
Halffacet_handle f;
if(assign(f, o)) {
CGAL_NEF_TRACEN("Found facet ");
I.does_intersect_internally(r, f, ip);
SNC_intersection::does_intersect_internally(r, f, ip);
ip = normalized(ip);
v = C.create_from_facet(f,ip);
pl->add_vertex(v);

View File

@ -901,9 +901,8 @@ public:
++t2;
if(t2 == segs2.end()) t2=segs2.begin();
SNC_intersection is;
Point_3 ip;
bool flag=is.does_intersect_internally(Segment_3(*s1,*t1),Segment_3(*s2,*t2),ip);
bool flag = SNC_intersection::does_intersect_internally(Segment_3(*s1,*t1),Segment_3(*s2,*t2),ip);
if(!flag) {
if(*s1 == *s2) return normalized(*s1);
else if(*s1 == *t2) return normalized(*s1);

View File

@ -17,6 +17,7 @@
#include <CGAL/basic.h>
#include <CGAL/Circulator_project.h>
#undef CGAL_NEF_DEBUG
#define CGAL_NEF_DEBUG 37
@ -39,13 +40,10 @@ struct Project_shalfedge_point {
};
template<typename SNC_structure_>
class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
// TODO: granados: is it really necessary to inherit from the decorator?
class SNC_intersection {
typedef SNC_structure_ SNC_structure;
typedef SNC_intersection<SNC_structure> Self;
typedef SNC_const_decorator<SNC_structure> Base;
// typedef SNC_const_decorator<SNC_structure> SNC_const_decorator;
typedef typename SNC_structure::SHalfedge SHalfedge;
typedef typename SNC_structure::Halfedge_handle Halfedge_handle;
@ -58,108 +56,31 @@ class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
typedef typename SNC_structure::Halffacet_cycle_const_iterator
Halffacet_cycle_const_iterator;
typedef typename SNC_structure::Point_3 Point_3;
typedef typename SNC_structure::Vector_3 Vector_3;
typedef typename SNC_structure::Segment_3 Segment_3;
typedef typename SNC_structure::Line_3 Line_3;
typedef typename SNC_structure::Ray_3 Ray_3;
typedef typename SNC_structure::Plane_3 Plane_3;
typedef typename SNC_structure::Triangle_3 Triangle_3;
public:
SNC_intersection() : Base() {}
SNC_intersection(const SNC_structure& W) : Base(W) {}
bool does_contain_internally(const Point_3& s, const Point_3& t, const Point_3& p) const {
static bool does_contain_internally(const Point_3& s,
const Point_3& t,
const Point_3& p) {
return are_strictly_ordered_along_line (s, p, t);
}
bool does_contain_internally( Halffacet_const_handle f,
const Point_3& p,
bool check_has_on = true) const {
if(check_has_on && !f->plane().has_on(p))
static bool does_contain_internally(Halffacet_const_handle f,
const Point_3& p) {
if(!f->plane().has_on(p))
return false;
return (locate_point_in_halffacet( p, f) == CGAL::ON_BOUNDED_SIDE);
return point_in_facet_interior( p, f);
}
bool does_contain_on_boundary( Halffacet_const_handle f, const Point_3& p) const {
typedef Project_shalfedge_point
< SHalfedge, const Point_3> Project;
typedef Circulator_project
< SHalfedge_around_facet_const_circulator, Project,
const Point_3&, const Point_3*> Circulator;
Halffacet_cycle_const_iterator fc = f->facet_cycles_begin();
CGAL_assertion(fc.is_shalfedge());
if (fc.is_shalfedge() ) {
SHalfedge_const_handle se(fc);
SHalfedge_around_facet_const_circulator hfc(se);
Circulator c(hfc), cp(c), cend(c);
do {
c++;
CGAL_NEF_TRACEN("contained on edge "<<Segment_3( *c, *cp)<<"? "<<
Segment_3( *c, *cp).has_on(p));
if( Segment_3( *c, *cp).has_on(p))
return true;
cp++;
}
while( c != cend);
}
Halffacet_cycle_const_iterator fe = f->facet_cycles_end();
++fc;
CGAL_For_all(fc, fe) {
if (fc.is_shalfloop() ) {
SHalfloop_const_handle l(fc);
CGAL_NEF_TRACEN("isolated point on "<<l->incident_sface()->center_vertex()->point()<<"? ");
if( l->incident_sface()->center_vertex()->point() == p)
return true;
}
else if (fc.is_shalfedge() ) {
SHalfedge_const_handle se(fc);
SHalfedge_around_facet_const_circulator hfc(se);
Circulator c(hfc), cp(c), cend(c);
do {
c++;
CGAL_NEF_TRACEN("contained on edge "<<Segment_3( *c, *cp)<<"? "<<
Segment_3( *c, *cp).has_on(p));
if( Segment_3( *c, *cp).has_on(p))
return true;
cp++;
}
while( c != cend);
}
else
CGAL_error_msg( "Damn wrong handle.");
}
return false;
}
#ifdef LINE3_LINE3_INTERSECTION
bool does_intersect_internally( const Segment_3& s1,
const Segment_3& s2,
Point_3& p) const {
CGAL_NEF_TRACEN("does intersect internally with LINE3_LINE3_INTERSECTION");
if ( s1.is_degenerate() || s2.is_degenerate())
/* the segment is degenerate so there is not internal intersection */
return false;
if ( s1.has_on(s2.source()) || s1.has_on(s2.target()) ||
s2.has_on(s1.source()) || s2.has_on(s1.target()))
/* the segments does intersect at one endpoint */
return false;
Object o = intersection(Line_3(ray), Line_3(s));
if ( !CGAL::assign(p, o))
return false;
return( does_contain_internally( s, p));
}
#else // LINE3_LINE3_INTERSECTION
bool does_intersect_internally( const Segment_3& s1,
const Segment_3& s2,
Point_3& p) const {
static bool does_intersect_internally(const Segment_3& s1,
const Segment_3& s2,
Point_3& p) {
if(s2.has_on(s1.target()))
return false;
Ray_3 r(s1.source(), s1.target());
@ -169,14 +90,10 @@ class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
return (pl.oriented_side(p) == CGAL::NEGATIVE);
}
bool does_intersect_internally( const Ray_3& s1,
const Segment_3& s2,
Point_3& p) const {
CGAL_NEF_TRACEN("does intersect internally without LINE3_LINE3_INTERSECTION");
CGAL_assertion(!s1.is_degenerate());
CGAL_assertion(!s2.is_degenerate());
if ( orientation( s1.source(), s1.point(1), s2.source(), s2.target())
!= COPLANAR)
static bool does_intersect_internally(const Ray_3& s1,
const Segment_3& s2,
Point_3& p) {
if (!coplanar( s1.source(), s1.point(1), s2.source(), s2.target()))
// the segments doesn't define a plane
return false;
if ( s1.has_on(s2.source()) || s1.has_on(s2.target()) ||
@ -190,7 +107,7 @@ class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
return false;
Vector_3 vs1(s1.to_vector()), vs2(s2.to_vector()),
vt(cross_product( vs1, vs2)),
ws1(cross_product( vt, vs1)); // , ws2(cross_product( vt, vs2));
ws1(cross_product( vt, vs1));
Plane_3 hs1( s1.source(), ws1);
Object o = intersection(hs1, ls2);
CGAL_assertion(CGAL::assign( p, o));
@ -207,73 +124,28 @@ class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
return (pl.oriented_side(p) == CGAL::NEGATIVE);
}
#endif // LINE3_LINE3_INTERSECTION
bool does_intersect( const Ray_3& r, const Triangle_3& tr,
Point_3& ip) const {
// Intersection between an open ray and
// a closed 2d-triangular region in the space
CGAL_NEF_TRACEN("-> Intersection triangle - ray");
CGAL_NEF_TRACEN(" -> Ray: "<<r);
CGAL_NEF_TRACEN(" -> Triangle: "<<tr);
CGAL_assertion( !r.is_degenerate());
Plane_3 h( tr.supporting_plane());
CGAL_assertion( !h.is_degenerate());
if( h.has_on( r.source()))
return false;
Object o = intersection( h, r);
if( !CGAL::assign( ip, o))
return false;
CGAL_NEF_TRACEN(" -> intersection point: "<<ip);
return tr.has_on(ip);
}
bool does_intersect( const Segment_3& s, const Triangle_3& tr,
Point_3& ip) const {
// Intersection between a open segment and
// a closed 2d-triangular region in the space
CGAL_NEF_TRACEN("-> Intersection triangle - segment");
CGAL_NEF_TRACEN(" -> Segment: "<<s);
CGAL_NEF_TRACEN(" -> Triangle: "<<tr);
CGAL_assertion( !s.is_degenerate());
Plane_3 h( tr.supporting_plane());
CGAL_assertion( !h.is_degenerate());
if( h.has_on( s.source()) || h.has_on( s.target()))
return false;
Object o = intersection( h, s);
if( !CGAL::assign( ip, o))
return false;
CGAL_NEF_TRACEN(" -> intersection point: "<<ip);
return tr.has_on(ip);
}
bool does_intersect_internally( const Ray_3& ray,
Halffacet_const_handle f,
Point_3& p,
bool checkHasOn = true) const {
static bool does_intersect_internally(const Ray_3& ray,
Halffacet_const_handle f,
Point_3& p) {
CGAL_NEF_TRACEN("-> Intersection facet - ray");
Plane_3 h( f->plane());
CGAL_NEF_TRACEN("-> facet's plane: " << h);
CGAL_NEF_TRACEN("-> a point on the plane: " << h.point());
CGAL_NEF_TRACEN("-> ray: " << ray);
CGAL_assertion(!ray.is_degenerate());
if(checkHasOn) {
if(h.has_on(ray.source()))
return false;
} else
CGAL_assertion(!h.has_on(ray.source()));
if(h.has_on(ray.source()))
return false;
Object o = intersection( h, ray);
if( !CGAL::assign( p, o))
return false;
CGAL_NEF_TRACEN( "-> intersection point: " << p );
CGAL_NEF_TRACEN( "-> point in facet interior? "<<does_contain_internally( f, p));
return does_contain_internally( f, p, false);
CGAL_NEF_TRACEN( "-> point in facet interior? "<<point_in_facet_interior( f, p));
return point_in_facet_interior( p, f);
}
bool does_intersect_internally( const Segment_3& seg,
Halffacet_const_handle f,
Point_3& p) const {
static bool does_intersect_internally(const Segment_3& seg,
Halffacet_const_handle f,
Point_3& p) {
CGAL_NEF_TRACEN("-> Intersection facet - segment");
Plane_3 h( f->plane());
CGAL_NEF_TRACEN("-> facet's plane: " << h);
@ -283,24 +155,23 @@ class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
if( h.has_on( seg.source()) || h.has_on(seg.target()))
/* no possible internal intersection */
return false;
return does_intersect(seg, f, p);
}
bool does_intersect(const Segment_3& seg,
Halffacet_const_handle f,
Point_3& p) const {
Plane_3 h( f->plane());
Object o = intersection( h, seg);
if( !CGAL::assign( p, o))
return false;
CGAL_NEF_TRACEN( "-> intersection point: " << p );
CGAL_NEF_TRACEN( "-> point in facet interior? "<<does_contain_internally( f, p));
return( does_contain_internally( f, p, false));
CGAL_NEF_TRACEN( "-> point in facet interior? "<<point_in_facet_interior( f, p));
return point_in_facet_interior( p, f);
}
private:
Bounded_side locate_point_in_halffacet( const Point_3& p,
Halffacet_const_handle f) const {
static bool point_in_facet_interior(const Point_3& p,
Halffacet_const_handle f) {
return (locate_point_in_halffacet( p, f) == CGAL::ON_BOUNDED_SIDE);
}
static Bounded_side locate_point_in_halffacet(const Point_3& p,
Halffacet_const_handle f) {
CGAL_NEF_TRACEN("locate point in halffacet " << p << ", " << f->plane());
typedef Project_shalfedge_point
< SHalfedge, const Point_3> Project;

View File

@ -250,8 +250,8 @@ public:
else if( CGAL::assign( e, *o) && ((mask&2) != 0)) {
Point_3 q;
_CGAL_NEF_TRACEN("trying edge on "<< Segment_3(e->source()->point(),e->twin()->source()->point()));
if( is.does_intersect_internally( ray, Segment_3(e->source()->point(),
e->twin()->source()->point()), q)) {
if( SNC_intersection::does_intersect_internally( ray, Segment_3(e->source()->point(),
e->twin()->source()->point()), q)) {
_CGAL_NEF_TRACEN("ray intersects edge on "<<q);
_CGAL_NEF_TRACEN("prev. intersection? "<<hit);
CGAL_assertion_code
@ -272,7 +272,7 @@ public:
Point_3 q;
_CGAL_NEF_TRACEN("trying facet with on plane "<<f->plane()<<
" with point on "<<f->plane().point());
if( is.does_intersect_internally( ray, f, q, true) ) {
if( SNC_intersection::does_intersect_internally( ray, f, q) ) {
_CGAL_NEF_TRACEN("ray intersects facet on "<<q);
_CGAL_NEF_TRACEN("prev. intersection? "<<hit);
if( hit) { _CGAL_NEF_TRACEN("prev. intersection on "<<eor); }
@ -319,14 +319,14 @@ public:
}
}
else if( CGAL::assign( e, *o)) {
if ( is.does_contain_internally(e->source()->point(), e->twin()->source()->point(), p) ) {
if ( SNC_intersection::does_contain_internally(e->source()->point(), e->twin()->source()->point(), p) ) {
_CGAL_NEF_TRACEN("found on edge "<<Segment_3(e->source()->point(),e->twin()->source()->point()));
result = make_object(e);
found = true;
}
}
else if( CGAL::assign( f, *o)) {
if (is.does_contain_internally( f, p) ) {
if (SNC_intersection::does_contain_internally( f, p) ) {
_CGAL_NEF_TRACEN("found on facet...");
result = make_object(f);
found = true;
@ -415,11 +415,11 @@ public:
// (e->source() == v || e->twin()->source() == v)) continue;
Segment_3 ss(e->source()->point(),e->twin()->source()->point());
CGAL_NEF_TRACEN("test edge " << e->source()->point() << "->" << e->twin()->source()->point());
if (is.does_contain_internally(e->source()->point(), e->twin()->source()->point(), p)) {
if (SNC_intersection::does_contain_internally(e->source()->point(), e->twin()->source()->point(), p)) {
_CGAL_NEF_TRACEN("found on edge "<< ss);
return make_object(e);
}
if((e->source() != v) && (e->twin()->source() != v) && is.does_intersect_internally(s, ss, ip)) {
if((e->source() != v) && (e->twin()->source() != v) && SNC_intersection::does_intersect_internally(s, ss, ip)) {
// first = false;
s = Segment_3(p, normalized(ip));
result = make_object(e);
@ -428,7 +428,7 @@ public:
} else
if( CGAL::assign( f, *o)) {
CGAL_NEF_TRACEN("test facet " << f->plane());
if (is.does_contain_internally(f,p) ) {
if (SNC_intersection::does_contain_internally(f,p) ) {
_CGAL_NEF_TRACEN("found on facet...");
return make_object(f);
}
@ -449,7 +449,7 @@ public:
}
if( (! v_vertex_of_f) && is.does_intersect_internally(s,f,ip) ) {
if( (! v_vertex_of_f) && SNC_intersection::does_intersect_internally(s,f,ip) ) {
s = Segment_3(p, normalized(ip));
result = make_object(f);
}
@ -461,13 +461,13 @@ public:
/*
Halffacet_iterator fc;
CGAL_forall_facets(fc, *this->sncp()) {
CGAL_assertion(!is.does_intersect_internally(s,f,ip));
CGAL_assertion(!SNC_intersection::does_intersect_internally(s,f,ip));
}
Halfedge_iterator ec;
CGAL_forall_edges(ec, *this->sncp()) {
Segment_3 ss(ec->source()->point(), ec->twin()->source()->point());
CGAL_assertion(!is.does_intersect_internally(s,ss,ip));
CGAL_assertion(!SNC_intersection::does_intersect_internally(s,ss,ip));
}
Vertex_iterator vc;
@ -495,7 +495,7 @@ public:
for(;ox!=candidates.end();++ox) {
if(!CGAL::assign(e,*ox)) continue;
CGAL_NEF_TRACEN("test edge " << e->source()->point() << "->" << e->twin()->source()->point());
if(is.does_intersect_internally(s,Segment_3(e->source()->point(),e->twin()->source()->point()),ip)) {
if(SNC_intersection::does_intersect_internally(s,Segment_3(e->source()->point(),e->twin()->source()->point()),ip)) {
s = Segment_3(p, normalized(ip));
result = make_object(e);
}
@ -551,8 +551,8 @@ public:
#endif
Point_3 q;
if( is.does_intersect_internally( s, Segment_3(e->source()->point(),
e->twin()->source()->point()), q)) {
if( SNC_intersection::does_intersect_internally( s, Segment_3(e->source()->point(),
e->twin()->source()->point()), q)) {
q = normalized(q);
call_back( e0, make_object(Halfedge_handle(e)), q);
_CGAL_NEF_TRACEN("edge intersects edge "<<' '<<&*e<< Segment_3(e->source()->point(),
@ -565,7 +565,7 @@ public:
#endif
Point_3 q;
if( is.does_intersect_internally( s, f, q) ) {
if( SNC_intersection::does_intersect_internally( s, f, q) ) {
q = normalized(q);
call_back( e0, make_object(Halffacet_handle(f)), q);
_CGAL_NEF_TRACEN("edge intersects facet on plane "<<f->plane()<<" on "<<q);
@ -600,8 +600,8 @@ public:
#endif
Point_3 q;
if( is.does_intersect_internally( s, Segment_3(e->source()->point(),
e->twin()->source()->point()), q)) {
if( SNC_intersection::does_intersect_internally( s, Segment_3(e->source()->point(),
e->twin()->source()->point()), q)) {
q = normalized(q);
call_back( e0, make_object(Halfedge_handle(e)), q);
_CGAL_NEF_TRACEN("edge intersects edge "<<' '<<&*e<< Segment_3(e->source()->point(),
@ -643,7 +643,7 @@ public:
#endif
Point_3 q;
if( is.does_intersect_internally( s, f, q) ) {
if( SNC_intersection::does_intersect_internally( s, f, q) ) {
q = normalized(q);
call_back( e0, make_object(Halffacet_handle(f)), q);
_CGAL_NEF_TRACEN("edge intersects facet on plane "<<f->plane()<<" on "<<q);
@ -705,7 +705,6 @@ public:
private:
bool initialized;
SNC_candidate_provider* candidate_provider;
SNC_intersection is;
};

View File

@ -39,7 +39,6 @@ struct binop_intersection_test_segment_tree {
template<class Callback>
struct Bop_edge0_face1_callback {
SNC_intersection &is;
Callback &cb;
struct Pair_hash_function {
@ -57,8 +56,8 @@ struct binop_intersection_test_segment_tree {
}
};
Bop_edge0_face1_callback(SNC_intersection &is, Callback &cb)
: is(is), cb(cb)
Bop_edge0_face1_callback(Callback &cb)
: cb(cb)
{}
void operator()( Nef_box& box0, Nef_box& box1 ) {
@ -71,7 +70,7 @@ struct binop_intersection_test_segment_tree {
if( Infi_box::degree( f1->plane().d() ) > 0 )
return;
Point_3 ip;
if( is.does_intersect_internally( Const_decorator::segment(e0), f1, ip )) {
if( SNC_intersection::does_intersect_internally( Const_decorator::segment(e0), f1, ip )) {
cb(e0,make_object(f1),ip);
}
}
@ -80,11 +79,10 @@ struct binop_intersection_test_segment_tree {
template<class Callback>
struct Bop_edge1_face0_callback {
SNC_intersection &is;
Callback &cb;
Bop_edge1_face0_callback(SNC_intersection &is, Callback &cb)
: is(is), cb(cb)
Bop_edge1_face0_callback(Callback &cb)
: cb(cb)
{}
void operator()( Nef_box& box0, Nef_box& box1 ) {
@ -97,19 +95,18 @@ struct binop_intersection_test_segment_tree {
if( Infi_box::degree( f0->plane().d() ) > 0 )
return;
Point_3 ip;
if( is.does_intersect_internally( Const_decorator::segment( e1 ),
f0, ip ) )
if( SNC_intersection::does_intersect_internally( Const_decorator::segment( e1 ),
f0, ip ) )
cb(e1,make_object(f0),ip);
}
};
template<class Callback>
struct Bop_edge0_edge1_callback {
SNC_intersection &is;
Callback &cb;
Bop_edge0_edge1_callback(SNC_intersection &is, Callback &cb)
: is(is), cb(cb)
Bop_edge0_edge1_callback(Callback &cb)
: cb(cb)
{}
void operator()( Nef_box& box0, Nef_box& box1 ) {
@ -120,8 +117,8 @@ struct binop_intersection_test_segment_tree {
Halfedge_iterator e0 = box0.get_halfedge();
Halfedge_iterator e1 = box1.get_halfedge();
Point_3 ip;
if( is.does_intersect_internally( Const_decorator::segment( e0 ),
Const_decorator::segment( e1 ), ip ))
if( SNC_intersection::does_intersect_internally( Const_decorator::segment( e0 ),
Const_decorator::segment( e1 ), ip ))
cb(e0,make_object(e1),ip);
}
};
@ -135,10 +132,9 @@ struct binop_intersection_test_segment_tree {
Halfedge_iterator e0, e1;
Halffacet_iterator f0, f1;
std::vector<Nef_box> a, b;
SNC_intersection is( sncp );
CGAL_NEF_TRACEN("start edge0 edge1");
Bop_edge0_edge1_callback<Callback> callback_edge0_edge1( is, cb0 );
Bop_edge0_edge1_callback<Callback> callback_edge0_edge1( cb0 );
CGAL_forall_edges( e0, sncp) a.push_back( Nef_box( e0 ) );
CGAL_forall_edges( e1, snc1i) b.push_back( Nef_box( e1 ) );
#ifdef CGAL_NEF3_BOX_INTERSECTION_CUTOFF
@ -153,7 +149,7 @@ struct binop_intersection_test_segment_tree {
b.clear();
CGAL_NEF_TRACEN("start edge0 face1");
Bop_edge0_face1_callback<Callback> callback_edge0_face1( is, cb0 );
Bop_edge0_face1_callback<Callback> callback_edge0_face1( cb0 );
CGAL_forall_edges( e0, sncp ) a.push_back( Nef_box( e0 ) );
CGAL_forall_facets( f1, snc1i) b.push_back( Nef_box( f1 ) );
#ifdef CGAL_NEF3_BOX_INTERSECTION_CUTOFF
@ -168,7 +164,7 @@ struct binop_intersection_test_segment_tree {
b.clear();
CGAL_NEF_TRACEN("start edge1 face0");
Bop_edge1_face0_callback<Callback> callback_edge1_face0( is, cb1 );
Bop_edge1_face0_callback<Callback> callback_edge1_face0( cb1 );
CGAL_forall_edges( e1, snc1i) a.push_back( Nef_box( e1 ) );
CGAL_forall_facets( f0, sncp ) b.push_back( Nef_box( f0 ) );
#ifdef CGAL_NEF3_BOX_INTERSECTION_CUTOFF

View File

@ -499,112 +499,111 @@ private:
if(Infi_box::standard_kernel()) {
Nef_polyhedron N = load_nef3("star.nef3.SH");
SNC_intersection is(*N.sncp());
Point_3 p;
assert(!is.does_contain_internally(
assert(!SNC_intersection::does_contain_internally(
Point_3(0,0,0), Point_3(2,0,0),
Point_3(0,0,0)));
assert(!is.does_contain_internally(
assert(!SNC_intersection::does_contain_internally(
Point_3(0,0,0), Point_3(2,0,0),
Point_3(2,0,0)));
assert(!is.does_contain_internally(
assert(!SNC_intersection::does_contain_internally(
Point_3(0,0,0), Point_3(2,0,0),
Point_3(3,0,0)));
assert(!is.does_contain_internally(
assert(!SNC_intersection::does_contain_internally(
Point_3(0,0,0), Point_3(2,0,0),
Point_3(-1,0,0)));
assert(!is.does_contain_internally(
assert(!SNC_intersection::does_contain_internally(
Point_3(0,0,0), Point_3(2,0,0),
Point_3(1,1,0)));
assert(!is.does_contain_internally(
assert(!SNC_intersection::does_contain_internally(
Point_3(0,0,0), Point_3(2,0,0),
Point_3(7,25,11)));
assert(is.does_contain_internally(
assert(SNC_intersection::does_contain_internally(
Point_3(0,0,0), Point_3(2,0,0),
Point_3(1,0,0)));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,1,0), Point_3(0,-1,0)),
Segment_3(Point_3(0,0,0), Point_3(-1,0,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,1,0), Point_3(0,-1,0)),
Segment_3(Point_3(1,0,0), Point_3(0,0,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,1,0), Point_3(0,-1,1)),
Segment_3(Point_3(1,0,0), Point_3(-1,0,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,1,0), Point_3(0,-1,0)),
Segment_3(Point_3(0,2,0), Point_3(0,0,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,1,0), Point_3(0,-1,0)),
Segment_3(Point_3(0,3,0), Point_3(0,1,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,1,0), Point_3(0,-1,0)),
Segment_3(Point_3(0,4,0), Point_3(0,2,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,1,0), Point_3(0,-1,0)),
Segment_3(Point_3(1,5,0), Point_3(1,7,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,1,0), Point_3(0,-1,0)),
Segment_3(Point_3(1,7,0), Point_3(1,5,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,1,0), Point_3(0,-1,0)),
Segment_3(Point_3(3,0,0), Point_3(1,0,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,1,0), Point_3(0,-1,0)),
Segment_3(Point_3(1,0,0), Point_3(3,0,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,3,0), Point_3(0,1,0)),
Segment_3(Point_3(1,0,0), Point_3(-1,0,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,1,0), Point_3(0,3,0)),
Segment_3(Point_3(1,0,0), Point_3(-1,0,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,3,0), Point_3(0,1,0)),
Segment_3(Point_3(1,0,0), Point_3(3,0,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,1,0), Point_3(0,3,0)),
Segment_3(Point_3(1,0,0), Point_3(3,0,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,3,0), Point_3(0,1,0)),
Segment_3(Point_3(3,0,0), Point_3(1,0,0)), p));
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,1,0), Point_3(0,3,0)),
Segment_3(Point_3(3,0,0), Point_3(1,0,0)), p));
assert(is.does_intersect_internally(
assert(SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,1,0), Point_3(0,-1,0)),
Segment_3(Point_3(1,0,0), Point_3(-1,0,0)), p));
assert(p == Point_3(0,0,0));
Halffacet_const_iterator hf;
assert(!is.does_contain_internally(
assert(!SNC_intersection::does_contain_internally(
N.halffacets_begin(), Point_3(0,0,0)));
CGAL_forall_halffacets(hf, N)
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(-31,15,0),Point_3(-31,15,1)),hf,p));
CGAL_forall_halffacets(hf, N)
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(-31,15,-1),Point_3(-31,15,0)),hf,p));
CGAL_forall_halffacets(hf, N)
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(-31,15,0),Point_3(-30,15,0)),hf,p));
CGAL_forall_halffacets(hf, N)
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(-32,15,-1),Point_3(-32,15,0)),hf,p));
CGAL_forall_halffacets(hf, N)
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(-16,8,-1),Point_3(-16,8,0)),hf,p));
CGAL_forall_halffacets(hf, N)
assert(!is.does_intersect_internally(
assert(!SNC_intersection::does_intersect_internally(
Segment_3(Point_3(0,0,-1),Point_3(0,0,1)),hf,p));
int i=0;
CGAL_forall_halffacets(hf, N) {
bool b = (i == 13 || i == 15);
assert( b == is.does_intersect_internally(
assert( b == SNC_intersection::does_intersect_internally(
Segment_3(Point_3(-31,15,-1),Point_3(-31,15,1)),
hf, p));
if(b) assert(p == Point_3(-31,15,0));
@ -614,7 +613,7 @@ private:
i=0;
CGAL_forall_halffacets(hf, N) {
bool b = (i == 14 || i == 16);
assert( b == is.does_intersect_internally(
assert( b == SNC_intersection::does_intersect_internally(
Segment_3(Point_3(-15,7,-1), Point_3(-15,7,1)),
hf, p));
if(b) assert(p == Point_3(-15,7,0));