From 42aa3c3c870629e2c764aa6d037018e12a70fda2 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 20 Mar 2022 10:44:16 +0000 Subject: [PATCH 01/16] Remove unused code, make methods static --- Nef_3/include/CGAL/Nef_3/SNC_intersection.h | 158 +++--------------- .../CGAL/Nef_3/binop_intersection_tests.h | 2 +- 2 files changed, 20 insertions(+), 140 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h index b527bba1792..e45fb81b265 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h @@ -17,6 +17,7 @@ #include +#include #undef CGAL_NEF_DEBUG #define CGAL_NEF_DEBUG 37 @@ -39,13 +40,10 @@ struct Project_shalfedge_point { }; template -class SNC_intersection : public SNC_const_decorator { - // TODO: granados: is it really necessary to inherit from the decorator? +class SNC_intersection { typedef SNC_structure_ SNC_structure; typedef SNC_intersection Self; - typedef SNC_const_decorator Base; - // typedef SNC_const_decorator SNC_const_decorator; typedef typename SNC_structure::SHalfedge SHalfedge; typedef typename SNC_structure::Halfedge_handle Halfedge_handle; @@ -58,108 +56,32 @@ class SNC_intersection : public SNC_const_decorator { 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, + static bool does_contain_internally( Halffacet_const_handle f, const Point_3& p, - bool check_has_on = true) const { + bool check_has_on = true) { if(check_has_on && !f->plane().has_on(p)) return false; return (locate_point_in_halffacet( p, f) == CGAL::ON_BOUNDED_SIDE); } - - 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 "<facet_cycles_end(); - ++fc; - CGAL_For_all(fc, fe) { - if (fc.is_shalfloop() ) { - SHalfloop_const_handle l(fc); - CGAL_NEF_TRACEN("isolated point on "<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 "< { return (pl.oriented_side(p) == CGAL::NEGATIVE); } - bool does_intersect_internally( const Ray_3& s1, + static bool does_intersect_internally( const Ray_3& s1, const Segment_3& s2, - Point_3& p) const { + Point_3& p) { CGAL_NEF_TRACEN("does intersect internally without LINE3_LINE3_INTERSECTION"); CGAL_assertion(!s1.is_degenerate()); CGAL_assertion(!s2.is_degenerate()); @@ -207,50 +129,10 @@ class SNC_intersection : public SNC_const_decorator { 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: "< Triangle: "< intersection point: "< Intersection triangle - segment"); - CGAL_NEF_TRACEN(" -> Segment: "< Triangle: "< intersection point: "< Intersection facet - ray"); Plane_3 h( f->plane()); CGAL_NEF_TRACEN("-> facet's plane: " << h); @@ -270,10 +152,9 @@ class SNC_intersection : public SNC_const_decorator { return does_contain_internally( f, p, false); } - - bool does_intersect_internally( const Segment_3& seg, + static bool does_intersect_internally( const Segment_3& seg, Halffacet_const_handle f, - Point_3& p) const { + Point_3& p) { CGAL_NEF_TRACEN("-> Intersection facet - segment"); Plane_3 h( f->plane()); CGAL_NEF_TRACEN("-> facet's plane: " << h); @@ -286,9 +167,9 @@ class SNC_intersection : public SNC_const_decorator { return does_intersect(seg, f, p); } - bool does_intersect(const Segment_3& seg, + static bool does_intersect(const Segment_3& seg, Halffacet_const_handle f, - Point_3& p) const { + Point_3& p) { Plane_3 h( f->plane()); Object o = intersection( h, seg); if( !CGAL::assign( p, o)) @@ -298,9 +179,8 @@ class SNC_intersection : public SNC_const_decorator { return( does_contain_internally( f, p, false)); } - - Bounded_side locate_point_in_halffacet( const Point_3& p, - Halffacet_const_handle f) const { + 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; diff --git a/Nef_3/include/CGAL/Nef_3/binop_intersection_tests.h b/Nef_3/include/CGAL/Nef_3/binop_intersection_tests.h index 0960a16d812..384e3a9fca5 100644 --- a/Nef_3/include/CGAL/Nef_3/binop_intersection_tests.h +++ b/Nef_3/include/CGAL/Nef_3/binop_intersection_tests.h @@ -135,7 +135,7 @@ struct binop_intersection_test_segment_tree { Halfedge_iterator e0, e1; Halffacet_iterator f0, f1; std::vector a, b; - SNC_intersection is( sncp ); + SNC_intersection is; CGAL_NEF_TRACEN("start edge0 edge1"); Bop_edge0_edge1_callback callback_edge0_edge1( is, cb0 ); From 99e8bece4c026ae7037dfbfff54e734ccf5b9fcc Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 20 Mar 2022 10:44:16 +0000 Subject: [PATCH 02/16] Standardise check_has_on parameter name --- Nef_3/include/CGAL/Nef_3/SNC_intersection.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h index e45fb81b265..0866dbc7c5e 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h @@ -132,14 +132,14 @@ class SNC_intersection { static bool does_intersect_internally( const Ray_3& ray, Halffacet_const_handle f, Point_3& p, - bool checkHasOn = true) { + bool check_has_on = true) { 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(check_has_on) { if(h.has_on(ray.source())) return false; } else From fdc647b510b98126b460ac8a5abafa8129cc31d7 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 20 Mar 2022 10:44:16 +0000 Subject: [PATCH 03/16] Standardise parameter wrapping --- Nef_3/include/CGAL/Nef_3/SNC_intersection.h | 40 ++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h index 0866dbc7c5e..2271ea2716e 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h @@ -71,17 +71,17 @@ class SNC_intersection { return are_strictly_ordered_along_line (s, p, t); } - static bool does_contain_internally( Halffacet_const_handle f, - const Point_3& p, - bool check_has_on = true) { + static bool does_contain_internally(Halffacet_const_handle f, + const Point_3& p, + bool check_has_on = true) { if(check_has_on && !f->plane().has_on(p)) return false; return (locate_point_in_halffacet( p, f) == CGAL::ON_BOUNDED_SIDE); } - static bool does_intersect_internally( const Segment_3& s1, - const Segment_3& s2, - Point_3& p) { + 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()); @@ -91,9 +91,9 @@ class SNC_intersection { return (pl.oriented_side(p) == CGAL::NEGATIVE); } - static bool does_intersect_internally( const Ray_3& s1, - const Segment_3& s2, - Point_3& p) { + static bool does_intersect_internally(const Ray_3& s1, + const Segment_3& s2, + Point_3& p) { CGAL_NEF_TRACEN("does intersect internally without LINE3_LINE3_INTERSECTION"); CGAL_assertion(!s1.is_degenerate()); CGAL_assertion(!s2.is_degenerate()); @@ -129,10 +129,10 @@ class SNC_intersection { return (pl.oriented_side(p) == CGAL::NEGATIVE); } - static bool does_intersect_internally( const Ray_3& ray, - Halffacet_const_handle f, - Point_3& p, - bool check_has_on = true) { + static bool does_intersect_internally(const Ray_3& ray, + Halffacet_const_handle f, + Point_3& p, + bool check_has_on = true) { CGAL_NEF_TRACEN("-> Intersection facet - ray"); Plane_3 h( f->plane()); CGAL_NEF_TRACEN("-> facet's plane: " << h); @@ -152,9 +152,9 @@ class SNC_intersection { return does_contain_internally( f, p, false); } - static bool does_intersect_internally( const Segment_3& seg, - Halffacet_const_handle f, - Point_3& p) { + 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); @@ -168,8 +168,8 @@ class SNC_intersection { } static bool does_intersect(const Segment_3& seg, - Halffacet_const_handle f, - Point_3& p) { + Halffacet_const_handle f, + Point_3& p) { Plane_3 h( f->plane()); Object o = intersection( h, seg); if( !CGAL::assign( p, o)) @@ -179,8 +179,8 @@ class SNC_intersection { return( does_contain_internally( f, p, false)); } - static Bounded_side locate_point_in_halffacet( const Point_3& p, - Halffacet_const_handle f) { + 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; From c4fc25ad82a1c94aac81b7d43b7837fe4374956f Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 20 Mar 2022 10:44:17 +0000 Subject: [PATCH 04/16] Use simpler and faster tests for internal segment intersection --- Nef_3/include/CGAL/Nef_3/SNC_intersection.h | 48 +++++---------------- 1 file changed, 10 insertions(+), 38 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h index 2271ea2716e..528cc5e5028 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h @@ -82,51 +82,21 @@ class SNC_intersection { static bool does_intersect_internally(const Segment_3& s1, const Segment_3& s2, Point_3& p) { - if(s2.has_on(s1.target())) + if(s1.has_on(s2.source()) || s1.has_on(s2.target()) || + s2.has_on(s1.source()) || s2.has_on(s1.target())) return false; - Ray_3 r(s1.source(), s1.target()); - if(!does_intersect_internally(r, s2, p)) - return false; - Plane_3 pl(s1.target(), r.to_vector()); - return (pl.oriented_side(p) == CGAL::NEGATIVE); + Object o = intersection(s1, s2); + return CGAL::assign(p,o); } static bool does_intersect_internally(const Ray_3& s1, const Segment_3& s2, Point_3& p) { - 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) - // the segments doesn't define a plane + if(s1.has_on(s2.source()) || s1.has_on(s2.target()) || + s2.has_on(s1.source())) return false; - if ( s1.has_on(s2.source()) || s1.has_on(s2.target()) || - s2.has_on(s1.source())) - // the segments does intersect at one endpoint - return false; - Line_3 ls1(s1), ls2(s2); - if ( ls1.direction() == ls2.direction() || - ls1.direction() == -ls2.direction() ) - // the segments are parallel - 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)); - Plane_3 hs1( s1.source(), ws1); - Object o = intersection(hs1, ls2); - CGAL_assertion(CGAL::assign( p, o)); - // since line(s1) and line(s2) are not parallel they intersects in only - // one point - CGAL::assign( p ,o); - Plane_3 pl(s1.source(), vs1); - if(pl.oriented_side(p) != CGAL::POSITIVE) - return false; - pl = Plane_3(s2.source(), vs2); - if(pl.oriented_side(p) != CGAL::POSITIVE) - return false; - pl = Plane_3(s2.target(), vs2); - return (pl.oriented_side(p) == CGAL::NEGATIVE); + Object o = intersection(s1, s2); + return CGAL::assign(p,o); } static bool does_intersect_internally(const Ray_3& ray, @@ -179,6 +149,8 @@ class SNC_intersection { return( does_contain_internally( f, p, false)); } + private: + 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()); From 7411d76e2fecb5d398fff44d4f81ecdf611f356a Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 20 Mar 2022 10:44:17 +0000 Subject: [PATCH 05/16] Inline function as its only called once --- Nef_3/include/CGAL/Nef_3/SNC_intersection.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h index 528cc5e5028..fccb520d829 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h @@ -134,13 +134,6 @@ class SNC_intersection { if( h.has_on( seg.source()) || h.has_on(seg.target())) /* no possible internal intersection */ return false; - return does_intersect(seg, f, p); - } - - static bool does_intersect(const Segment_3& seg, - Halffacet_const_handle f, - Point_3& p) { - Plane_3 h( f->plane()); Object o = intersection( h, seg); if( !CGAL::assign( p, o)) return false; From 0124fc9e6dab100af07e7ddd65ed36914271891e Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 20 Mar 2022 10:44:17 +0000 Subject: [PATCH 06/16] Call appropriate function with different name --- Nef_3/include/CGAL/Nef_3/SNC_intersection.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h index fccb520d829..0985024837b 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h @@ -76,7 +76,7 @@ class SNC_intersection { bool check_has_on = true) { if(check_has_on && !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); } static bool does_intersect_internally(const Segment_3& s1, @@ -118,8 +118,8 @@ class SNC_intersection { if( !CGAL::assign( p, o)) return false; CGAL_NEF_TRACEN( "-> intersection point: " << p ); - CGAL_NEF_TRACEN( "-> point in facet interior? "< point in facet interior? "< intersection point: " << p ); - CGAL_NEF_TRACEN( "-> point in facet interior? "< point in facet interior? "<plane()); From e451af9f506f84384a5b26e21d28ece6b0772b9a Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 20 Mar 2022 10:44:17 +0000 Subject: [PATCH 07/16] As a consequence of previous changes check_has_on is never called with false --- Nef_3/include/CGAL/Nef_3/SNC_intersection.h | 15 +++++---------- Nef_3/include/CGAL/Nef_3/SNC_point_locator.h | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h index 0985024837b..1726fd8194d 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h @@ -72,9 +72,8 @@ class SNC_intersection { } static bool does_contain_internally(Halffacet_const_handle f, - const Point_3& p, - bool check_has_on = true) { - if(check_has_on && !f->plane().has_on(p)) + const Point_3& p) { + if(!f->plane().has_on(p)) return false; return point_in_facet_interior( p, f); } @@ -101,19 +100,15 @@ class SNC_intersection { static bool does_intersect_internally(const Ray_3& ray, Halffacet_const_handle f, - Point_3& p, - bool check_has_on = true) { + 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(check_has_on) { - 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; diff --git a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h index 964952874e6..c967910dec2 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h @@ -272,7 +272,7 @@ public: Point_3 q; _CGAL_NEF_TRACEN("trying facet with on plane "<plane()<< " with point on "<plane().point()); - if( is.does_intersect_internally( ray, f, q, true) ) { + if( is.does_intersect_internally( ray, f, q) ) { _CGAL_NEF_TRACEN("ray intersects facet on "< Date: Mon, 21 Mar 2022 20:36:40 +0000 Subject: [PATCH 08/16] Coplanar check is a worthwhile performance tweak --- Nef_3/include/CGAL/Nef_3/SNC_intersection.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h index 1726fd8194d..414b1b83b51 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h @@ -81,6 +81,8 @@ class SNC_intersection { static bool does_intersect_internally(const Segment_3& s1, const Segment_3& s2, Point_3& p) { + if(!coplanar(s1.source(), s1.target(), s2.source(), s2.target())) + return false; if(s1.has_on(s2.source()) || s1.has_on(s2.target()) || s2.has_on(s1.source()) || s2.has_on(s1.target())) return false; @@ -91,6 +93,8 @@ class SNC_intersection { 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())) + return false; if(s1.has_on(s2.source()) || s1.has_on(s2.target()) || s2.has_on(s1.source())) return false; From 13592cc496423cc7086c14f09830e13900957639 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Tue, 22 Mar 2022 07:37:04 +0000 Subject: [PATCH 09/16] Using planes is faster for ray intersections --- Nef_3/include/CGAL/Nef_3/SNC_intersection.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h index 414b1b83b51..b220593a73d 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h @@ -98,8 +98,19 @@ class SNC_intersection { if(s1.has_on(s2.source()) || s1.has_on(s2.target()) || s2.has_on(s1.source())) return false; - Object o = intersection(s1, s2); - return CGAL::assign(p,o); + + Vector_3 vs1(s1.to_vector()), vs2(s2.to_vector()), + vt(cross_product( vs1, vs2)), + ws1(cross_product( vt, vs1)); + Plane_3 hs1( s1.source(), ws1); + Object o = intersection(hs1, s2); + if(!CGAL::assign( p ,o)) + return false; + Plane_3 pl(s1.source(), vs1); + if(pl.oriented_side(p) != CGAL::POSITIVE) + return false; + + return true; } static bool does_intersect_internally(const Ray_3& ray, From c8d04092976bee903ae6521480bd712a42287176 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Tue, 22 Mar 2022 19:46:25 +0000 Subject: [PATCH 10/16] Using planes is faster for segment intersections --- Nef_3/include/CGAL/Nef_3/SNC_intersection.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h index b220593a73d..c5bb98a8c44 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h @@ -81,13 +81,13 @@ class SNC_intersection { static bool does_intersect_internally(const Segment_3& s1, const Segment_3& s2, Point_3& p) { - if(!coplanar(s1.source(), s1.target(), s2.source(), s2.target())) + if(s2.has_on(s1.target())) return false; - if(s1.has_on(s2.source()) || s1.has_on(s2.target()) || - s2.has_on(s1.source()) || s2.has_on(s1.target())) + Ray_3 r(s1.source(), s1.target()); + if(!does_intersect_internally(r, s2, p)) return false; - Object o = intersection(s1, s2); - return CGAL::assign(p,o); + Plane_3 pl(s1.target(), r.to_vector()); + return (pl.oriented_side(p) == CGAL::NEGATIVE); } static bool does_intersect_internally(const Ray_3& s1, From dc18d7abb240568daa7664b5aad68aacef4ef409 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Tue, 22 Mar 2022 21:00:57 +0000 Subject: [PATCH 11/16] Restore other predicates in ray_segment intersections --- Nef_3/include/CGAL/Nef_3/SNC_intersection.h | 29 ++++++++++++++------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h index c5bb98a8c44..a804f7099b5 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_intersection.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_intersection.h @@ -93,24 +93,35 @@ class SNC_intersection { 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())) + 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()) || - s2.has_on(s1.source())) + if ( s1.has_on(s2.source()) || s1.has_on(s2.target()) || + s2.has_on(s1.source())) + // the segments does intersect at one endpoint + return false; + Line_3 ls1(s1), ls2(s2); + if ( ls1.direction() == ls2.direction() || + ls1.direction() == -ls2.direction() ) + // the segments are parallel return false; - Vector_3 vs1(s1.to_vector()), vs2(s2.to_vector()), vt(cross_product( vs1, vs2)), ws1(cross_product( vt, vs1)); Plane_3 hs1( s1.source(), ws1); - Object o = intersection(hs1, s2); - if(!CGAL::assign( p ,o)) - return false; + Object o = intersection(hs1, ls2); + CGAL_assertion(CGAL::assign( p, o)); + // since line(s1) and line(s2) are not parallel they intersects in only + // one point + CGAL::assign( p ,o); Plane_3 pl(s1.source(), vs1); if(pl.oriented_side(p) != CGAL::POSITIVE) return false; - - return true; + pl = Plane_3(s2.source(), vs2); + if(pl.oriented_side(p) != CGAL::POSITIVE) + return false; + pl = Plane_3(s2.target(), vs2); + return (pl.oriented_side(p) == CGAL::NEGATIVE); } static bool does_intersect_internally(const Ray_3& ray, From 73908092088866007dca40b1aa8366671a062bd8 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 23 Mar 2022 08:14:01 +0100 Subject: [PATCH 12/16] Fix in the testcode --- Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h b/Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h index 826f58ceb27..4ce725aeca4 100644 --- a/Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h +++ b/Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h @@ -499,7 +499,7 @@ private: if(Infi_box::standard_kernel()) { Nef_polyhedron N = load_nef3("star.nef3.SH"); - SNC_intersection is(*N.sncp()); + SNC_intersection is; Point_3 p; From 4e7bbff6dffe16468906e4f8cc1f0c448b84cad8 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 23 Mar 2022 09:45:23 +0100 Subject: [PATCH 13/16] Don't use a variable for calling a static method (VC2015 warned) --- .../include/CGAL/Convex_decomposition_3/Ray_hit_generator.h | 5 ++--- .../include/CGAL/Convex_decomposition_3/Ray_hit_generator2.h | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h index a3b60b73293..1e6490214b7 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h @@ -81,7 +81,6 @@ class Ray_hit_generator : public Modifier_base { } Point_3 ip; - SNC_intersection I; SNC_constructor C(*sncp); Halfedge_handle e; @@ -89,7 +88,7 @@ class Ray_hit_generator : public Modifier_base { 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 { 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); diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator2.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator2.h index 6fb98e4f858..e5d928c0cc9 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator2.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator2.h @@ -87,7 +87,6 @@ class Ray_hit_generator2 : public Modifier_base { } Point_3 ip; - SNC_intersection I; SNC_constructor C(*sncp); Halfedge_handle e; @@ -95,7 +94,7 @@ class Ray_hit_generator2 : public Modifier_base { 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 { 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); From 45365e473c40b08c6035f094cbcb6ef9c0293814 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 23 Mar 2022 10:04:37 +0100 Subject: [PATCH 14/16] Don't use a variable for calling a static method (VC2015 warned) --- Nef_3/include/CGAL/Nef_3/SNC_point_locator.h | 37 ++++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h index c967910dec2..3a64bcf5195 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h @@ -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 "<plane()<< " with point on "<plane().point()); - if( is.does_intersect_internally( ray, f, q) ) { + if( SNC_intersection::does_intersect_internally( ray, f, q) ) { _CGAL_NEF_TRACEN("ray intersects facet on "<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 "<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; @@ -417,11 +417,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); @@ -430,7 +430,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); } @@ -451,7 +451,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); } @@ -463,13 +463,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; @@ -497,7 +497,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); } @@ -553,8 +553,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(), @@ -567,7 +567,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 "<plane()<<" on "<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(), @@ -645,7 +645,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 "<plane()<<" on "< Date: Wed, 23 Mar 2022 10:47:24 +0100 Subject: [PATCH 15/16] Don't use a variable for calling a static method (VC2015 warned) --- Nef_3/include/CGAL/Nef_3/SNC_constructor.h | 3 +- .../CGAL/Nef_3/binop_intersection_tests.h | 32 ++++++++----------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_constructor.h b/Nef_3/include/CGAL/Nef_3/SNC_constructor.h index 23041cff316..0216dd56295 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_constructor.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_constructor.h @@ -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); diff --git a/Nef_3/include/CGAL/Nef_3/binop_intersection_tests.h b/Nef_3/include/CGAL/Nef_3/binop_intersection_tests.h index 384e3a9fca5..1dd83c8027f 100644 --- a/Nef_3/include/CGAL/Nef_3/binop_intersection_tests.h +++ b/Nef_3/include/CGAL/Nef_3/binop_intersection_tests.h @@ -39,7 +39,6 @@ struct binop_intersection_test_segment_tree { template 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 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 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 a, b; - SNC_intersection is; CGAL_NEF_TRACEN("start edge0 edge1"); - Bop_edge0_edge1_callback callback_edge0_edge1( is, cb0 ); + Bop_edge0_edge1_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_edge0_face1( is, cb0 ); + Bop_edge0_face1_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_edge1_face0( is, cb1 ); + Bop_edge1_face0_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 From 913c6155ec04957c44c28fb25025f838cd4a2cdf Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 24 Mar 2022 08:55:27 +0100 Subject: [PATCH 16/16] Don't use a variable for calling a static method (VC2015 warned) --- Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h | 67 +++++++++++----------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h b/Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h index 4ce725aeca4..1eb31fac55a 100644 --- a/Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h +++ b/Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h @@ -499,112 +499,111 @@ private: if(Infi_box::standard_kernel()) { Nef_polyhedron N = load_nef3("star.nef3.SH"); - SNC_intersection is; 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));