Skip to content

Commit

Permalink
fix debug
Browse files Browse the repository at this point in the history
  • Loading branch information
sloriot committed Jan 30, 2025
1 parent 4e841ff commit ce77ee4
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 33 deletions.
1 change: 1 addition & 0 deletions Nef_2/include/CGAL/Nef_2/Segment_overlay_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ class stl_seg_overlay_traits {
out << "SweepStatus:\n";
typename SweepStatus::iterator sit3;
for( sit3 = YS.begin(); *sit3 != &sh; ++sit3 ) {
if (*sit3==&sl) continue;
int b = orientation(sit3, p_sweep);
if(*sit3 == &sl) out << " 1";
else if(*sit3 == &sh) out <<"-1";
Expand Down
2 changes: 1 addition & 1 deletion Nef_3/include/CGAL/Nef_3/K3_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ Node_handle build_kdtree(Vertex_list& V, Halfedge_list& E, Halffacet_list& F,

int coord = depth%3;
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
Side_of_plane sop(point_on_plane, coord, reference_counted);
Expand Down
22 changes: 14 additions & 8 deletions Nef_3/include/CGAL/Nef_3/SNC_external_structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ class SNC_external_structure_base : public SNC_decorator<SNC_structure_>
CGAL_forall_iterators(it,M4) {
// progress++;
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;
CGAL_forall_iterators(itl,it->second) {
Halfedge_handle e1 = itl->e;
Expand All @@ -482,7 +482,7 @@ class SNC_external_structure_base : public SNC_decorator<SNC_structure_>
Halfedge_handle e2 = itl->e;
CGAL_NEF_TRACEN(" " << e1->source()->point()
<< " -> " << e2->source()->point());
CGAL_NEF_TRACEN(e1->vector()<<" -> "<<-e2->vector());
CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<<-e2->vector());
make_twins(e1,e2);
CGAL_assertion(e1->mark()==e2->mark());

Expand All @@ -493,7 +493,7 @@ class SNC_external_structure_base : public SNC_decorator<SNC_structure_>
CGAL_forall_iterators(it,M3) {
// progress++;
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;
CGAL_forall_iterators(itl,it->second) {
Halfedge_handle e1 = itl->e;
Expand All @@ -502,7 +502,7 @@ class SNC_external_structure_base : public SNC_decorator<SNC_structure_>
Halfedge_handle e2 = itl->e;
CGAL_NEF_TRACEN(" " << e1->source()->point()
<< " -> " << e2->source()->point());
CGAL_NEF_TRACEN(e1->vector()<<" -> "<<-e2->vector());
CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<<-e2->vector());
make_twins(e1,e2);
CGAL_assertion(e1->mark()==e2->mark());

Expand All @@ -513,7 +513,7 @@ class SNC_external_structure_base : public SNC_decorator<SNC_structure_>
CGAL_forall_iterators(it,M2) {
// progress++;
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;
CGAL_forall_iterators(itl,it->second) {
Halfedge_handle e1 = itl->e;
Expand All @@ -522,7 +522,7 @@ class SNC_external_structure_base : public SNC_decorator<SNC_structure_>
Halfedge_handle e2 = itl->e;
CGAL_NEF_TRACEN(" " << e1->source()->point()
<< " -> " << e2->source()->point());
CGAL_NEF_TRACEN(e1->vector()<<" -> "<<-e2->vector());
CGAL_NEF_TRACEN(" " << e1->vector()<<" -> "<<-e2->vector());
make_twins(e1,e2);
CGAL_assertion(e1->mark()==e2->mark());

Expand All @@ -533,7 +533,7 @@ class SNC_external_structure_base : public SNC_decorator<SNC_structure_>
CGAL_forall_iterators(it,M) {
// progress++;
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;
CGAL_forall_iterators(itl,it->second) {
Halfedge_handle e1 = itl->e;
Expand All @@ -542,7 +542,7 @@ class SNC_external_structure_base : public SNC_decorator<SNC_structure_>
Halfedge_handle e2 = itl->e;
CGAL_NEF_TRACEN(" " << e1->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->mark()==e2->mark());
make_twins(e1,e2);
Expand Down Expand Up @@ -585,10 +585,16 @@ class SNC_external_structure_base : public SNC_decorator<SNC_structure_>
break;
} else
#endif
CGAL_assertion_code(bool found = false;)
CGAL_For_all(cet,cete)
if ( cet->circle() == ce->circle().opposite() &&
cet->source()->twin() == ce->source() )
{
found = true;
break;
}

CGAL_assertion(found);

#ifdef CGAL_USE_TRACE
if( cet->circle() != ce->circle().opposite() )
Expand Down
4 changes: 2 additions & 2 deletions Nef_3/include/CGAL/Nef_3/SNC_intersection.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ 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( f, p));
// CGAL_NEF_TRACEN( "-> point in facet interior? "<<point_in_facet_interior( f, p));
return point_in_facet_interior( p, f);
}

Expand All @@ -159,7 +159,7 @@ 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( f, p));
// CGAL_NEF_TRACEN( "-> point in facet interior? "<<point_in_facet_interior( f, p));
return point_in_facet_interior( p, f);
}

Expand Down
4 changes: 2 additions & 2 deletions Nef_3/include/CGAL/Nef_3/SNC_point_locator.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ class SNC_point_locator_by_spatial_subdivision :
e = *ei;
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)) {
_CGAL_NEF_TRACEN("found on edge "<< ss);
// _CGAL_NEF_TRACEN("found on edge "<< ss);
return make_object(e);
}
if((e->source() != v) && (e->twin()->source() != v) &&
Expand Down Expand Up @@ -557,7 +557,7 @@ class SNC_point_locator_by_spatial_subdivision :
if(SNC_intersection::does_intersect_internally( s, *f, q) ) {
q = normalized(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;
}
Expand Down
27 changes: 11 additions & 16 deletions Nef_3/test/Nef_3/issue8644.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


#include <CGAL/Extended_cartesian.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
Expand All @@ -8,12 +6,10 @@
#include <CGAL/Polygon_mesh_processing/orientation.h>
#include <CGAL/Nef_polyhedron_3.h>

#define DATA_DIR std::string("./data/")+
using AFT=CGAL::Exact_rational;
using AExtended_kernel=CGAL::Extended_cartesian<AFT>;
using ANef_polyhedron_3=CGAL::Nef_polyhedron_3<AExtended_kernel>;

///////////////////////////////////////////////////////////////////////////////
using AFT=CGAL::Exact_rational; //CGAL::Gmpzf; CGAL::Exact_rational CGAL::Exact_integer
using AExtended_kernel=CGAL::Extended_cartesian<AFT>; //CGAL::Exact_predicates_exact_constructions_kernel ; //CGAL::Filtered_extended_homogeneous<RT>;
using ANef_polyhedron_3=CGAL::Nef_polyhedron_3<AExtended_kernel>;//CGAL::Exact_predicates_exact_constructions_kernel>;
template<typename SM>
void compute_volume_kernel_surface_mesh(SM& sm,
ANef_polyhedron_3& res)
Expand All @@ -30,7 +26,7 @@ void compute_volume_kernel_surface_mesh(SM& sm,
res*=ANef_polyhedron_3(eplane);
}
}
////////////////////////////////////////////////////////////////////////////////

void test_sm(const std::string& filename, bool rev)
{
CGAL::Surface_mesh<CGAL::Exact_predicates_inexact_constructions_kernel::Point_3> sm;
Expand All @@ -45,18 +41,17 @@ void test_sm(const std::string& filename, bool rev)
compute_volume_kernel_surface_mesh(sm, res);

if(res.is_empty())
{ std::cout<<"["<<filename<<"]: empty kernel."<<std::endl;}
std::cout<<"["<<filename<<"]: empty kernel."<<std::endl;
else
{ std::cout<<"["<<filename<<"]: NON empty kernel."<<std::endl;}
std::cout<<"["<<filename<<"]: NON empty kernel."<<std::endl;
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

int main(/* int argc, char** argv */)
{
test_sm(std::string(DATA_DIR"lshape1_dim3.off"), true);
test_sm(std::string(DATA_DIR"lshape1_dim3.off"), false);
test_sm(std::string(DATA_DIR"ushape1_dim3.off"), true);
test_sm(std::string(DATA_DIR"ushape1_dim3.off"), false);
test_sm(std::string("data/lshape1_dim3.off"), true);
test_sm(std::string("data/lshape1_dim3.off"), false);
test_sm(std::string("data/ushape1_dim3.off"), true);
test_sm(std::string("data/ushape1_dim3.off"), false);
return 0;
}

8 changes: 4 additions & 4 deletions Nef_3/test/Nef_3/issue8644bis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
using Kernel = CGAL::Extended_cartesian<CGAL::Gmpq>;
using Nef = CGAL::Nef_polyhedron_3<Kernel>;

int main(int argc, char ** argv)
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; // Line 14. Works fine.
Nef intersection_2 = hspace_2*hspace_3; // Line 15. Assertion failure.
Nef intersection_1 = hspace_1*hspace_2;
Nef intersection_2 = hspace_2*hspace_3;

return 0;
}

0 comments on commit ce77ee4

Please sign in to comment.