From d145abaf9a49bf5c5546b26a3d34be402a061552 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 8 Oct 2019 17:39:35 +0200 Subject: [PATCH] temporarily change the example for debugging : the commented queries do pass --- .../Triangulation_segment_traverser_3_impl.h | 1 + .../test_segment_simplex_traverser_3.cpp | 48 +++++++++---------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3_impl.h b/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3_impl.h index 121906b3226..b2eaffe7e50 100644 --- a/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3_impl.h +++ b/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3_impl.h @@ -230,6 +230,7 @@ jump_to_intersecting_cell() //get<1>(_cur) is Locate_type and unchanged get<2>(_cur) = new_ch->index(ch->vertex(li)); //get<3>(_cur) is lj and unchanged + CGAL_assertion(get<0>(_cur)->vertex(get<2>(_cur)) == ch->vertex(li)); } else if (lt == Tr::EDGE) { diff --git a/Triangulation_3/test/Triangulation_3/test_segment_simplex_traverser_3.cpp b/Triangulation_3/test/Triangulation_3/test_segment_simplex_traverser_3.cpp index 6be034311ad..8f4673359eb 100644 --- a/Triangulation_3/test/Triangulation_3/test_segment_simplex_traverser_3.cpp +++ b/Triangulation_3/test/Triangulation_3/test_segment_simplex_traverser_3.cpp @@ -11,7 +11,8 @@ #include -//#define CGAL_TRIANGULATION_3_VERBOSE_TRAVERSER_EXAMPLE +#define CGAL_TRIANGULATION_3_VERBOSE_TRAVERSER_EXAMPLE +#define CGAL_T3_TEST_SIMPLEX_TRAVERSER // Define the kernel. typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; @@ -22,7 +23,11 @@ typedef CGAL::Delaunay_triangulation_3< Kernel > DT; typedef DT::Cell_handle Cell_handle; -typedef CGAL::Triangulation_segment_simplex_iterator_3
Simplex_traverser; +#ifdef CGAL_T3_TEST_SIMPLEX_TRAVERSER +typedef CGAL::Triangulation_segment_simplex_iterator_3
Traverser; +#else +typedef CGAL::Triangulation_segment_cell_iterator_3
Traverser; +#endif template bool test(const DT dt, const Big_tuple& tuple); @@ -55,12 +60,12 @@ int main(int, char* []) std::cerr << dt.number_of_finite_cells() << '\n'; const std::vector < std::tuple>> queries = { - // {{-1, 0, 0}, { 1, 0, 0}, {0, 0, 1, 2}}, // CFC: assertion - {{-1, 0, 0}, { 2, 0, 0}, {1, 0, 1, 2}}, // CFCV - // {{ 2, 0, 0}, {-1, 0, 0}, {1, 0, 1, 2}}, // reverse: assertion - {{-2, 0, 0}, { 2, 0, 0}, {2, 0, 1, 2}}, // VCFCV - {{ 2, 0, 0}, {-2, 0, 0}, {2, 0, 1, 2}}, // reverse case: VCFCV - {{-3, 0, 0}, { 3, 0, 0}, {2, 0, 1, 4}}, // bug + // {{-1, 0, 0}, { 1, 0, 0}, {0, 0, 1, 2}}, // CFC + // {{-1, 0, 0}, { 2, 0, 0}, {1, 0, 1, 2}}, // CFCV + // {{ 2, 0, 0}, {-1, 0, 0}, {1, 0, 1, 2}}, // reverse + // {{-2, 0, 0}, { 2, 0, 0}, {2, 0, 1, 2}}, // VCFCV + // {{ 2, 0, 0}, {-2, 0, 0}, {2, 0, 1, 2}}, // reverse case: VCFCV + // {{-3, 0, 0}, { 3, 0, 0}, {2, 0, 3, 2}}, // FVCFCVF {{-2, 0, 0}, { 2, 2, -2}, {2, 1, 0, 1}}, // bug {{ 2, 2, -2}, {-2, 0, 0}, {2, 1, 0, 1}}, // bug }; @@ -82,7 +87,7 @@ bool test(const DT dt, const Big_tuple& tuple) { std::cout << "\n#\n# Query segment: ( " << p1 << " , " << p2 << " )\n#\n"; - Simplex_traverser st(dt, p1, p2); + Traverser st(dt, p1, p2); unsigned int nb_cells = 0, nb_facets = 0, nb_edges = 0, nb_vertex = 0; unsigned int nb_collinear = 0; @@ -94,22 +99,11 @@ bool test(const DT dt, const Big_tuple& tuple) { ++inf; else { ++fin; - if (st.is_facet()) - ++nb_facets; - else if (st.is_edge()) - ++nb_edges; - else if (st.is_vertex()) - ++nb_vertex; - else if (st.is_cell()) - ++nb_cells; - - if (st.is_collinear()) { - ++nb_collinear; - std::cout << "collinear\n"; - } +#ifdef CGAL_T3_TEST_SIMPLEX_TRAVERSER switch (st->dimension()) { case 2: { + ++nb_facets; std::cout << "facet " << std::endl; DT::Facet f = *st; std::cout << " ( " << f.first->vertex((f.second + 1) & 3)->point() @@ -119,6 +113,7 @@ bool test(const DT dt, const Big_tuple& tuple) { break; } case 1: { + ++nb_edges; std::cout << "edge " << std::endl; DT::Edge e = *st; std::cout << " ( " << e.first->vertex(e.second)->point() << " " @@ -126,12 +121,14 @@ bool test(const DT dt, const Big_tuple& tuple) { break; } case 0: { + ++nb_vertex; std::cout << "vertex " << std::endl; DT::Vertex_handle v = *st; std::cout << " ( " << v->point() << " )\n"; break; } case 3: { + ++nb_cells; std::cout << "cell \n ( "; DT::Cell_handle ch = *st; for (int i = 0; i < 4; ++i) @@ -142,8 +139,9 @@ bool test(const DT dt, const Big_tuple& tuple) { default: CGAL_assume(false); } // end switch - } - } +#endif + } +} #ifdef CGAL_TRIANGULATION_3_VERBOSE_TRAVERSER_EXAMPLE std::cout << "While traversing from " << st.source() @@ -156,6 +154,7 @@ bool test(const DT dt, const Big_tuple& tuple) { std::cout << std::endl << std::endl; #endif +#ifdef CGAL_T3_TEST_SIMPLEX_TRAVERSER auto check_expected = [](unsigned value, unsigned expected) { if(value != expected) { std::cout << "\t ERROR: expected " << expected << '\n'; @@ -172,5 +171,6 @@ bool test(const DT dt, const Big_tuple& tuple) { std::cout << "\tnb vertices : " << nb_vertex << std::endl; result = result && check_expected(nb_vertex, expected_results[0]); std::cout << "\tnb collinear : " << nb_collinear << std::endl; +#endif return result; }