Subject: CGAL users discussion list
List archive
- From: David Keller <>
- To:
- Subject: Arrangement_with_history_2: precondition failure and patches
- Date: Fri, 14 Mar 2008 13:53:18 +0100
Hi,
I have some issues with Arrangement_with_history_2:
1. operator== in Arr_with_history_2_functions.h misses a return value
for the case of non-self-assignments. Attached is a patch
(arr_with_hist_return_value.patch) which fixes the problem for me.
2. If VERBOSE is defined there are several issues with
function-name-lookups in derived objects leading to compile-time
errors (at least for gcc 4.0 and later). Attached is a patch
(sweep_line_debug.patch) to fix this problem.
3. Inserting an overlapping but "not equal" curve in an
Arrangement_with_history_2 leads to a runtime-error (precondition
failure in Arrangement_2_functions.h at line 1579). Attached is a
reproducer (arr_with_history_overlapping_curves.cpp). What should
traits::equal_2_object() implement here: Equal graph or equal
representation? The case may actually be rare. However, I'm not
quite sure if the current implementation gives the desired
behavior. If so, it would possibly be a good choice to mention
this in the documentation.
Thanks and kind regards
David Keller
diff -Naur CGAL-3.3.1/include/CGAL/Arrangement_2/Arr_with_history_2_functions.h CGAL-3.3.1patched/include/CGAL/Arrangement_2/Arr_with_history_2_functions.h --- CGAL-3.3.1/include/CGAL/Arrangement_2/Arr_with_history_2_functions.h 2007-08-25 21:01:33.000000000 +0200 +++ CGAL-3.3.1patched/include/CGAL/Arrangement_2/Arr_with_history_2_functions.h 2008-03-06 12:48:55.000000000 +0100 @@ -74,7 +74,7 @@ return (*this); assign (arr); - return; + return (*this); } //-----------------------------------------------------------------------------
diff -Naur CGAL-3.3.1/include/CGAL/Basic_sweep_line_2.h CGAL-3.3.1patched/include/CGAL/Basic_sweep_line_2.h --- CGAL-3.3.1/include/CGAL/Basic_sweep_line_2.h 2007-08-25 21:01:32.000000000 +0200 +++ CGAL-3.3.1patched/include/CGAL/Basic_sweep_line_2.h 2008-03-14 08:25:40.000000000 +0100 @@ -47,7 +47,7 @@ #define CGAL_PRINT_INSERT(a) { std::cout << "+++ inserting "; \ (a)->Print(); \ std::cout << " currentPos = "; \ - PrintEvent(m_currentEvent); \ + this->PrintEvent(this->m_currentEvent); \ std::cout << "\n"; \ } #define CGAL_PRINT_ERASE(a) { std::cout << "--- erasing " ; \ diff -Naur CGAL-3.3.1/include/CGAL/Sweep_line_2.h CGAL-3.3.1patched/include/CGAL/Sweep_line_2.h --- CGAL-3.3.1/include/CGAL/Sweep_line_2.h 2007-08-25 21:01:33.000000000 +0200 +++ CGAL-3.3.1patched/include/CGAL/Sweep_line_2.h 2008-03-14 08:27:51.000000000 +0100 @@ -315,7 +315,7 @@ void _handle_right_curves() { CGAL_PRINT("Handling right curves (" ;); - CGAL_SL_DEBUG(PrintEvent(m_currentEvent);); + CGAL_SL_DEBUG(PrintEvent(this->m_currentEvent);); CGAL_PRINT(")\n";); if(! this->m_currentEvent->has_right_curves()) @@ -340,7 +340,7 @@ *currentOne); ((Subcurve*)(*currentOne))->set_hint(slIter); - CGAL_SL_DEBUG(PrintStatusLine();); + CGAL_SL_DEBUG(this->PrintStatusLine();); if ( slIter != this->m_statusLine.begin() ) { // get the previous curve in the y-str @@ -359,7 +359,7 @@ (this->m_status_line_insert_hint, *currentOne); ((Subcurve*)(*currentOne))->set_hint(slIter); - CGAL_SL_DEBUG(PrintStatusLine();); + CGAL_SL_DEBUG(this->PrintStatusLine();); //BZBZ // if the two curves were neighbours before, we dont need to intersect them again @@ -370,7 +370,7 @@ ++currentOne; } - CGAL_SL_DEBUG(PrintStatusLine();); + CGAL_SL_DEBUG(this->PrintStatusLine();); //the next Subcurve at the Y-str ++slIter; @@ -493,7 +493,7 @@ { CGAL_PRINT("remove_curve_from_status_line\n";); - CGAL_SL_DEBUG(PrintStatusLine();); + CGAL_SL_DEBUG(this->PrintStatusLine();); CGAL_SL_DEBUG(leftCurve->Print();); StatusLineIter sliter = leftCurve->get_hint();
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Arrangement_with_history_2.h> #include <CGAL/Arr_polyline_traits_2.h> #include <CGAL/Arr_non_caching_segment_traits_2.h> #include <CGAL/Arr_extended_dcel.h> struct VertexData {}; struct HalfedgeData {}; struct FaceData {}; typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Arr_non_caching_segment_traits_2<Kernel> SegmentTraits; typedef CGAL::Arr_polyline_traits_2<SegmentTraits> Traits; typedef CGAL::Arr_extended_dcel<Traits, VertexData, HalfedgeData, FaceData> Dcel; typedef CGAL::Arrangement_with_history_2<Traits,Dcel> Arrangement; typedef Traits::Curve_2 Curve; typedef Traits::Point_2 Point; int main() { Arrangement arr; std::vector<Curve> curves; std::vector<Point> points; points.push_back( Point( 0., 1. ) ); points.push_back( Point( 12., 1. ) ); curves.push_back( Curve( points.begin(), points.end() ) ); points.clear(); points.push_back( Point( 12., 1. ) ); points.push_back( Point( 10.0223, 8.94903 ) ); points.push_back( Point( 10., 11. ) ); curves.push_back( Curve( points.begin(), points.end() ) ); points.clear(); points.push_back( Point( 10., 11. ) ); points.push_back( Point( 6.11947, 6.9141 ) ); points.push_back( Point( 0., 1. ) ); curves.push_back( Curve( points.begin(), points.end() ) ); points.clear(); points.push_back( Point( 10., 11. ) ); points.push_back( Point( 6.94507, 8.18988 ) ); points.push_back( Point( 6., 5. ) ); curves.push_back( Curve( points.begin(), points.end() ) ); CGAL::insert_curves( arr, curves.begin(), curves.end() ); points.clear(); points.push_back( Point( 0., 1. ) ); points.push_back( Point( 7.08165, 1. ) ); points.push_back( Point( 12., 1. ) ); CGAL::insert_curve( arr, Curve( points.begin(), points.end() ) ); return 0; }
- Arrangement_with_history_2: precondition failure and patches, David Keller, 03/14/2008
- Re: [cgal-discuss] Arrangement_with_history_2: precondition failure and patches, efif, 03/15/2008
- Re: [cgal-discuss] Arrangement_with_history_2: precondition failure and patches, David Keller, 03/28/2008
- Re: [cgal-discuss] Arrangement_with_history_2: precondition failure and patches, efif, 03/15/2008
Archive powered by MHonArc 2.6.16.