Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] segmentation fault insert_at_vertices

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] segmentation fault insert_at_vertices


Chronological Thread 
  • From: Efi Fogel <>
  • To:
  • Subject: Re: [cgal-discuss] segmentation fault insert_at_vertices
  • Date: Sat, 19 Dec 2015 18:21:32 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:kS61Qh8NfPcnpv9uRHKM819IXTAuvvDOBiVQ1KB90eMcTK2v8tzYMVDF4r011RmSDduds6oMotGVmp6jcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47AblHf6ke/8SQVUk2mc1EleKKtQsb7tIee6aObw9XreQJGhT6wM/tZDS6dikHvjPQQmpZoMa0ryxHE8TNicuVSwn50dxrIx06vrpT4wJk2+CtZv7ct9tVLTL7hV6U+V71RSjo8YE4v48i+mBfCBSWI6XYYGjEbnBtGBAfI6Dn1W57wtm3xse8ri3rSBtH/Ub1hAWfq1KxsUhK90Co=

Hi,

Indeed, we have enhanced the polyline traits component.
Try the attached patch. I think it will solve the problem.
It has been already integrated into master.

Efi

   ____  _        ____             _
  /_____/_) o    /__________  __  //
 (____ (   (    (    (_/ (_/-(-'_(/
                         _/



On Sat, Dec 19, 2015 at 4:29 PM, Mateus Bellomo <> wrote:
Hello,

I'm making a program to generate a rectangular grid using Arrangement_2. I've finished the algorithm and it was working well but in the future I'll have to use a function that is present only in CGAL-4.7 so I've purged my cgal installation and got the CGAL-4.7.

After that the same program that was working before start to get Segmentation Fault. I think the lines 56 and 73 (both commented) are causing the Segmentation Fault. The program and input are attached.

Anyone knows if there is some major difference in this version of CGAL that is causing this error?

Thanks.

Mateus

diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h
index d19fb79..ca8361c 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h
@@ -721,14 +721,23 @@ public:
     Comparison_result operator()(const Point_2& p,
                                  const X_monotone_curve_2& xcv) const
     {
-      // Get the index of the subcurve in xcv containing p.
-      std::size_t i =
-        m_poly_traits.locate_impl(xcv, p, Are_all_sides_oblivious_tag());
-      CGAL_precondition(i != INVALID_INDEX);
-
-      // Compare the subcurve xcv[i] and p.
       const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
-      return geom_traits->compare_y_at_x_2_object()(p, xcv[i]);
+      if (! m_poly_traits.is_vertical_2_object()(xcv)) {
+        // Get the index of the subcurve in xcv containing p.
+        std::size_t i =
+          m_poly_traits.locate_impl(xcv, p, Are_all_sides_oblivious_tag());
+        CGAL_precondition(i != INVALID_INDEX);
+
+        // Compare the subcurve xcv[i] and p.
+        return geom_traits->compare_y_at_x_2_object()(p, xcv[i]);
+      }
+      // The curve is vertical
+      Comparison_result rc = geom_traits->compare_y_at_x_2_object()(p, xcv[0]);
+      if (rc == SMALLER) return SMALLER;
+      std::size_t n = xcv.number_of_subcurves();
+      rc = geom_traits->compare_y_at_x_2_object()(p, xcv[n-1]);
+      if (rc == LARGER) return LARGER;
+      return EQUAL;
     }
 
     /*! Obtain the location of the given curve_end with respect to the input



Archive powered by MHonArc 2.6.18.

Top of Page