temporarily change the example for debugging : the commented queries do pass

This commit is contained in:
Jane Tournois 2019-10-08 17:39:35 +02:00
parent 80553fbfb1
commit d145abaf9a
2 changed files with 25 additions and 24 deletions

View File

@ -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)
{

View File

@ -11,7 +11,8 @@
#include <CGAL/Random.h>
//#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<DT> Simplex_traverser;
#ifdef CGAL_T3_TEST_SIMPLEX_TRAVERSER
typedef CGAL::Triangulation_segment_simplex_iterator_3<DT> Traverser;
#else
typedef CGAL::Triangulation_segment_cell_iterator_3<DT> Traverser;
#endif
template <typename Big_tuple>
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<Point_3, Point_3, std::array<unsigned, 4>>> 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;
}