From c8de8bb80ca7121e025ea1e3afb9bee17054d072 Mon Sep 17 00:00:00 2001 From: Miguel Granados Date: Wed, 17 Dec 2003 15:41:44 +0000 Subject: [PATCH] bugfix on triangulation package --- .../Nef_3/include/CGAL/Nef_3/SNC_decorator.h | 44 +++++++++++-------- Packages/Nef_3/test/Nef_3/test_Nef_3.C | 11 ++--- .../include/CGAL/Partition_traits_2.h | 4 +- .../include/CGAL/partition_y_monotone_2.h | 8 +++- 4 files changed, 39 insertions(+), 28 deletions(-) diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_decorator.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_decorator.h index 6aa44f41e97..41f11c98add 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_decorator.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_decorator.h @@ -22,6 +22,10 @@ #ifndef CGAL_SNC_DECORATOR_H #define CGAL_SNC_DECORATOR_H +//#define CGAL_NEF3_SM_VISUALIZOR +//#define CGAL_NEF3_DUMP_SPHERE_MAPS +//#define CGAL_NEF3_DUMP_SNC_OPERATORS + #include #include #include @@ -43,7 +47,6 @@ #endif // CGAL_NEF3_SM_VISUALIZOR #undef _DEBUG #define _DEBUG 19 -//#define CGAL_NEF3_DUMP_SPHERE_MAPS #include CGAL_BEGIN_NAMESPACE @@ -205,7 +208,7 @@ public: /* Halffacet queries */ using(point); - // using(tmp_point); + using(tmp_point); // using(calc_point); using(segment); @@ -331,7 +334,7 @@ public: ep.hw().eval_at(1000)); } - Sphere_point tmp_point(Halfedge_handle e) const + const Sphere_point& tmp_point(Halfedge_handle e) const { return e->tmp_point(); } Sphere_point calc_point(Halfedge_handle e) const { CGAL_nef3_assertion(twin(e)!=Halfedge_handle()); @@ -807,6 +810,7 @@ public: TRACEN(v0->debug()); TRACEN(v1->debug()); IO0.debug(); IO1.debug(); + IO0.print(); IO1.print(); #endif // CGAL_NEF3_DUMP_SPHERE_MAPS CGAL_assertion( point(v0) == point(v1)); Vertex_handle v01 = rsnc.new_vertex( point(v0), BOP( mark(v0),mark(v1))); @@ -986,9 +990,9 @@ public: CGAL_nef3_assertion( result.is_empty()); CGAL_nef3_assertion( pl1 != NULL); - // Progress_indicator_cout v_qualifying - // (sncp()->number_of_vertices()+snc1i.number_of_vertices(), - // "binary_operator: qualifying vertices..."); + Progress_indicator_clog v_qualifying + (sncp()->number_of_vertices()+snc1i.number_of_vertices(), + "binary_operator: qualifying vertices..."); Unique_hash_map ignore(false); Vertex_iterator v0, v1; @@ -997,19 +1001,20 @@ public: // SETDTHREAD(19*131*43); TRACEN("=> binary operation"); - /* +#ifdef CGAL_NEF3_DUMP_SNC_OPERATORS TRACEN("=> first operand:"); SNC_io_parser O0(std::cout, *sncp()); O0.print(); TRACEN("=> second operand:"); SNC_io_parser O1(std::cout, snc1i); O1.print(); - */ +#endif // CGAL_NEF3_DUMP_SNC_OPERATORS + TRACEN("\nnumber of vertices (so far...) = "< for all v0 in snc0, qualify v0 with respect snc1"); CGAL_nef3_forall_vertices( v0, *sncp()) { - // v_qualifying++; + v_qualifying++; CGAL_nef3_assertion(!ignore[v0]); Point_3 p0(point(v0)); Vertex_handle v; @@ -1054,7 +1059,7 @@ public: TRACEN("=> for all v1 in snc1, qualify v1 with respect snc0"); CGAL_nef3_forall_vertices( v1, snc1i) { - // v_qualifying++; + v_qualifying++; if(ignore[v1]) continue; Point_3 p1(point(v1)); Vertex_handle v; @@ -1102,9 +1107,9 @@ public: Halfedge_iterator e0, e1; - // Progress_indicator_cout ee_intersections - // (sncp()->number_of_edges(), - // "binary_operator: finding edge-edge intersections..."); + Progress_indicator_clog ee_intersections + (sncp()->number_of_edges(), + "binary_operator: finding edge-edge intersections..."); Intersection_call_back call_back0 ( *sncp(), snc1i, BOP, result); @@ -1113,26 +1118,26 @@ public: TRACEN("=> finding edge-edge intersections..."); CGAL_nef3_forall_edges( e0, *sncp()) { - // ee_intersections++; + ee_intersections++; pl1->intersect_with_edges( e0, call_back0); } TRACEN("\nnumber of vertices (so far...) = "<number_of_edges()+snc1i.number_of_edges(), - // "binary_operator: finding edge-facet intersections..."); + Progress_indicator_clog ef_intersections + (sncp()->number_of_edges()+snc1i.number_of_edges(), + "binary_operator: finding edge-facet intersections..."); TRACEN("number of vertices (so far...) = "< finding edge0-facet1 intersections..."); CGAL_nef3_forall_edges( e0, *sncp()) { - // ef_intersections++; + ef_intersections++; pl1->intersect_with_facets( e0, call_back0); } TRACEN("\nnumber of vertices (so far...) = "< finding edge1-facet0 intersections..."); CGAL_nef3_forall_edges( e1, snc1i) { - // ef_intersections++; + ef_intersections++; pl()->intersect_with_facets( e1, call_back1); } TRACEN("\nnumber of vertices (so far...) = "< resultant vertices (after simplification): "); CGAL_nef3_forall_vertices( v0, result) TRACEN(&*v0<<" "< #include #include - #include template @@ -150,8 +149,9 @@ private: Nef_polyhedron load_off( char* name) { Polyhedron poly; - std::ifstream in(name); - in >> poly; + std::ifstream off_file(name); + CGAL_assertion(off_file != NULL); + off_file >> poly; Nef_polyhedron N(poly); return N; } @@ -903,7 +903,7 @@ private: CGAL_assertion(N.is_valid(0,0)); CGAL_assertion(does_nef3_equals_file(N,"cube_created_from_halfspaces.nef3.SH")); } - + Nef_polyhedron N,N2,P,R,S,T; N = load_off("data/centered_cube.off"); CGAL_assertion(N.is_valid(0,0)); @@ -1052,11 +1052,12 @@ template const char* test::datadir="data/"; int main() { - typedef CGAL::Gmpz NT; typedef CGAL::Simple_homogeneous SH_Kernel; typedef CGAL::Extended_homogeneous_3 EH_Kernel; + //std::cin>>debugthread; + CGAL::Timer t; t.start(); diff --git a/Packages/Nef_3/triangulation/include/CGAL/Partition_traits_2.h b/Packages/Nef_3/triangulation/include/CGAL/Partition_traits_2.h index d6ca4e22c49..1bd5a49e9c9 100644 --- a/Packages/Nef_3/triangulation/include/CGAL/Partition_traits_2.h +++ b/Packages/Nef_3/triangulation/include/CGAL/Partition_traits_2.h @@ -51,10 +51,10 @@ class Partition_traits_2 : public Partition_traits_2_base typedef CGAL::Polygon_2 Polygon_2; typedef typename Kernel::Less_yx_2 Less_yx_2; typedef typename Kernel::Less_xy_2 Less_xy_2; - typedef typename Kernel::Left_turn_2 Left_turn_2; + typedef typename Kernel::Left_turn_2 Left_turn_2; typedef typename Kernel::Orientation_2 Orientation_2; typedef typename Kernel::Compare_y_2 Compare_y_2; - typedef typename Kernel::Compare_x_2 Compare_x_2; + typedef CGAL::Is_convex_2 Is_convex_2; typedef CGAL::Is_y_monotone_2 Is_y_monotone_2; diff --git a/Packages/Nef_3/triangulation/include/CGAL/partition_y_monotone_2.h b/Packages/Nef_3/triangulation/include/CGAL/partition_y_monotone_2.h index ef931cf6d17..baa3c27959e 100644 --- a/Packages/Nef_3/triangulation/include/CGAL/partition_y_monotone_2.h +++ b/Packages/Nef_3/triangulation/include/CGAL/partition_y_monotone_2.h @@ -89,9 +89,13 @@ Partition_y_mono_vertex_type partition_y_mono_vertex_type( << " c " << *c << " next " << *next << std::endl; #endif typename Traits::Compare_y_2 compare_y_2 = traits.compare_y_2_object(); + typename Traits::Collinear_are_ordered_along_line_2 + collinear_are_ordered_along_line_2 + = traits.collinear_are_ordered_along_line_2_object(); if (compare_y_2(*previous, *c) == EQUAL && - compare_y_2(*next, *c) == EQUAL) + compare_y_2(*next, *c) == EQUAL && + collinear_are_ordered_along_line_2( *previous, *c, *next)) return PARTITION_Y_MONO_COLLINEAR_VERTEX; typename Traits::Less_yx_2 less_yx = traits.less_yx_2_object(); @@ -470,7 +474,7 @@ void partition_y_monotone_2( InputIterator first, InputIterator beyond, #ifdef CGAL_PARTITION_Y_MONOTONE_DEBUG std::cout << "Initial vertex list: "; - for(std::vector::const_iterator it = circulators.begin(); + for( typename std::vector::const_iterator it = circulators.begin(); it != circulators.end(); it++){ std::cout << **it << " " ;