Nef_3: Fix issue with the size of the inf box (#8646)

## Summary of Changes

Fixes Issue #8644

## Release Management

* Affected package(s): Nef_3
* Issue(s) solved (if any): fix #
* License and copyright ownership:  unchanged
This commit is contained in:
Sebastien Loriot 2025-02-05 08:26:27 +01:00 committed by GitHub
commit 8675d06ea1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 41 additions and 16 deletions

View File

@ -627,6 +627,7 @@ public:
out << "SweepStatus:\n"; out << "SweepStatus:\n";
typename SweepStatus::iterator sit3; typename SweepStatus::iterator sit3;
for( sit3 = YS.begin(); *sit3 != &sh; ++sit3 ) { for( sit3 = YS.begin(); *sit3 != &sh; ++sit3 ) {
if (*sit3==&sl) continue;
int b = orientation(sit3, p_sweep); int b = orientation(sit3, p_sweep);
if(*sit3 == &sl) out << " 1"; if(*sit3 == &sl) out << " 1";
else if(*sit3 == &sh) out <<"-1"; else if(*sit3 == &sh) out <<"-1";

View File

@ -402,9 +402,9 @@ class Infimaximal_box<Tag_true, Kernel> {
typename SNC_structure::Vertex_const_iterator v; typename SNC_structure::Vertex_const_iterator v;
CGAL_forall_vertices(v, snc) { CGAL_forall_vertices(v, snc) {
Point_3 p(v->point()); Point_3 p(v->point());
if(p.hx()[0] > eval) eval = p.hx()[0]; if(abs(p.hx()[0]) > eval) eval = abs(p.hx()[0]);
if(p.hy()[0] > eval) eval = p.hy()[0]; if(abs(p.hy()[0]) > eval) eval = abs(p.hy()[0]);
if(p.hz()[0] > eval) eval = p.hz()[0]; if(abs(p.hz()[0]) > eval) eval = abs(p.hz()[0]);
} }
eval *= 4; eval *= 4;
if(eval == 0) return 1; if(eval == 0) return 1;

View File

@ -517,7 +517,7 @@ Node_handle build_kdtree(Vertex_list& V, Halfedge_list& E, Halffacet_list& F,
int coord = depth%3; int coord = depth%3;
Point_3 point_on_plane = find_median_point(V, coord); Point_3 point_on_plane = find_median_point(V, coord);
CGAL_NEF_TRACEN("build_kdtree: plane: "<<partition_plane<< " " << point_on_plane); // CGAL_NEF_TRACEN("build_kdtree: plane: "<<partition_plane<< " " << point_on_plane);
#ifdef CGAL_NEF_EXPLOIT_REFERENCE_COUNTING #ifdef CGAL_NEF_EXPLOIT_REFERENCE_COUNTING
Side_of_plane sop(point_on_plane, coord, reference_counted); Side_of_plane sop(point_on_plane, coord, reference_counted);

View File

@ -473,7 +473,7 @@ public:
CGAL_forall_iterators(it,M4) { CGAL_forall_iterators(it,M4) {
// progress++; // progress++;
it->second.sort(Halfedge_key_lt()); it->second.sort(Halfedge_key_lt());
CGAL_NEF_TRACEN("search opposite "<<it->first); CGAL_NEF_TRACEN("search opposite (M4) "<<it->first);
typename Halfedge_list::iterator itl; typename Halfedge_list::iterator itl;
CGAL_forall_iterators(itl,it->second) { CGAL_forall_iterators(itl,it->second) {
Halfedge_handle e1 = itl->e; Halfedge_handle e1 = itl->e;
@ -482,7 +482,7 @@ public:
Halfedge_handle e2 = itl->e; Halfedge_handle e2 = itl->e;
CGAL_NEF_TRACEN(" " << e1->source()->point() CGAL_NEF_TRACEN(" " << e1->source()->point()
<< " -> " << e2->source()->point()); << " -> " << e2->source()->point());
CGAL_NEF_TRACEN(e1->vector()<<" -> "<<-e2->vector()); CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<<-e2->vector());
make_twins(e1,e2); make_twins(e1,e2);
CGAL_assertion(e1->mark()==e2->mark()); CGAL_assertion(e1->mark()==e2->mark());
@ -493,7 +493,7 @@ public:
CGAL_forall_iterators(it,M3) { CGAL_forall_iterators(it,M3) {
// progress++; // progress++;
it->second.sort(Halfedge_key_lt()); it->second.sort(Halfedge_key_lt());
CGAL_NEF_TRACEN("search opposite "<<it->first); CGAL_NEF_TRACEN("search opposite (M3) "<<it->first);
typename Halfedge_list::iterator itl; typename Halfedge_list::iterator itl;
CGAL_forall_iterators(itl,it->second) { CGAL_forall_iterators(itl,it->second) {
Halfedge_handle e1 = itl->e; Halfedge_handle e1 = itl->e;
@ -502,7 +502,7 @@ public:
Halfedge_handle e2 = itl->e; Halfedge_handle e2 = itl->e;
CGAL_NEF_TRACEN(" " << e1->source()->point() CGAL_NEF_TRACEN(" " << e1->source()->point()
<< " -> " << e2->source()->point()); << " -> " << e2->source()->point());
CGAL_NEF_TRACEN(e1->vector()<<" -> "<<-e2->vector()); CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<<-e2->vector());
make_twins(e1,e2); make_twins(e1,e2);
CGAL_assertion(e1->mark()==e2->mark()); CGAL_assertion(e1->mark()==e2->mark());
@ -513,7 +513,7 @@ public:
CGAL_forall_iterators(it,M2) { CGAL_forall_iterators(it,M2) {
// progress++; // progress++;
it->second.sort(Halfedge_key_lt()); it->second.sort(Halfedge_key_lt());
CGAL_NEF_TRACEN("search opposite "<<it->first); CGAL_NEF_TRACEN("search opposite (M2) "<<it->first);
typename Halfedge_list::iterator itl; typename Halfedge_list::iterator itl;
CGAL_forall_iterators(itl,it->second) { CGAL_forall_iterators(itl,it->second) {
Halfedge_handle e1 = itl->e; Halfedge_handle e1 = itl->e;
@ -522,7 +522,7 @@ public:
Halfedge_handle e2 = itl->e; Halfedge_handle e2 = itl->e;
CGAL_NEF_TRACEN(" " << e1->source()->point() CGAL_NEF_TRACEN(" " << e1->source()->point()
<< " -> " << e2->source()->point()); << " -> " << e2->source()->point());
CGAL_NEF_TRACEN(e1->vector()<<" -> "<<-e2->vector()); CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<<-e2->vector());
make_twins(e1,e2); make_twins(e1,e2);
CGAL_assertion(e1->mark()==e2->mark()); CGAL_assertion(e1->mark()==e2->mark());
@ -533,7 +533,7 @@ public:
CGAL_forall_iterators(it,M) { CGAL_forall_iterators(it,M) {
// progress++; // progress++;
it->second.sort(Halfedge_key_lt()); it->second.sort(Halfedge_key_lt());
CGAL_NEF_TRACEN("search opposite "<<it->first); CGAL_NEF_TRACEN("search opposite (M) "<<it->first);
typename Halfedge_list::iterator itl; typename Halfedge_list::iterator itl;
CGAL_forall_iterators(itl,it->second) { CGAL_forall_iterators(itl,it->second) {
Halfedge_handle e1 = itl->e; Halfedge_handle e1 = itl->e;
@ -542,7 +542,7 @@ public:
Halfedge_handle e2 = itl->e; Halfedge_handle e2 = itl->e;
CGAL_NEF_TRACEN(" " << e1->source()->point() CGAL_NEF_TRACEN(" " << e1->source()->point()
<< " -> " << e2->source()->point()); << " -> " << e2->source()->point());
CGAL_NEF_TRACEN(e1->vector()<<" -> "<< -e2->vector()); CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<< -e2->vector());
CGAL_assertion(e1->source()->point() != e2->source()->point()); CGAL_assertion(e1->source()->point() != e2->source()->point());
CGAL_assertion(e1->mark()==e2->mark()); CGAL_assertion(e1->mark()==e2->mark());
make_twins(e1,e2); make_twins(e1,e2);
@ -585,10 +585,16 @@ public:
break; break;
} else } else
#endif #endif
CGAL_assertion_code(bool found = false;)
CGAL_For_all(cet,cete) CGAL_For_all(cet,cete)
if ( cet->circle() == ce->circle().opposite() && if ( cet->circle() == ce->circle().opposite() &&
cet->source()->twin() == ce->source() ) cet->source()->twin() == ce->source() )
{
CGAL_assertion_code(found = true;)
break; break;
}
CGAL_assertion(found);
#ifdef CGAL_USE_TRACE #ifdef CGAL_USE_TRACE
if( cet->circle() != ce->circle().opposite() ) if( cet->circle() != ce->circle().opposite() )

View File

@ -139,7 +139,7 @@ class SNC_intersection {
if( !CGAL::assign( p, o)) if( !CGAL::assign( p, o))
return false; return false;
CGAL_NEF_TRACEN( "-> intersection point: " << p ); CGAL_NEF_TRACEN( "-> intersection point: " << p );
CGAL_NEF_TRACEN( "-> point in facet interior? "<<point_in_facet_interior( f, p)); // CGAL_NEF_TRACEN( "-> point in facet interior? "<<point_in_facet_interior( f, p));
return point_in_facet_interior( p, f); return point_in_facet_interior( p, f);
} }
@ -159,7 +159,7 @@ class SNC_intersection {
if( !CGAL::assign( p, o)) if( !CGAL::assign( p, o))
return false; return false;
CGAL_NEF_TRACEN( "-> intersection point: " << p ); CGAL_NEF_TRACEN( "-> intersection point: " << p );
CGAL_NEF_TRACEN( "-> point in facet interior? "<<point_in_facet_interior( f, p)); // CGAL_NEF_TRACEN( "-> point in facet interior? "<<point_in_facet_interior( f, p));
return point_in_facet_interior( p, f); return point_in_facet_interior( p, f);
} }

View File

@ -432,7 +432,7 @@ public:
e = *ei; e = *ei;
CGAL_NEF_TRACEN("test edge " << e->source()->point() << "->" << e->twin()->source()->point()); CGAL_NEF_TRACEN("test edge " << e->source()->point() << "->" << e->twin()->source()->point());
if (SNC_intersection::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); // _CGAL_NEF_TRACEN("found on edge "<< ss);
return make_object(e); return make_object(e);
} }
if((e->source() != v) && (e->twin()->source() != v) && if((e->source() != v) && (e->twin()->source() != v) &&
@ -557,7 +557,7 @@ private:
if(SNC_intersection::does_intersect_internally( s, *f, q) ) { if(SNC_intersection::does_intersect_internally( s, *f, q) ) {
q = normalized(q); q = normalized(q);
call_back( e0, *f, q); call_back( e0, *f, q);
_CGAL_NEF_TRACEN("edge intersects facet on plane "<<f->plane()<<" on "<<q); // _CGAL_NEF_TRACEN("edge intersects facet on plane "<<f->plane()<<" on "<<q);
} }
visited[*f] = true; visited[*f] = true;
} }

View File

@ -0,0 +1,18 @@
#include <CGAL/Extended_cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Nef_polyhedron_3.h>
using Kernel = CGAL::Extended_cartesian<CGAL::Exact_rational>;
using Nef = CGAL::Nef_polyhedron_3<Kernel>;
int main()
{
Nef hspace_1(Nef::Plane_3(1.0, 0.0, 0.0, 0.0), Nef::INCLUDED);
Nef hspace_2(Nef::Plane_3(1.0, 0.0, 0.0, 1.0), Nef::INCLUDED);
Nef hspace_3(Nef::Plane_3(0.0, 0.0, 1.0, 1.0), Nef::INCLUDED);
Nef intersection_1 = hspace_1*hspace_2;
Nef intersection_2 = hspace_2*hspace_3;
return 0;
}