Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Crash in 2D boolean difference

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Crash in 2D boolean difference


Chronological Thread 
  • From: Efi Fogel <>
  • To:
  • Subject: Re: [cgal-discuss] Crash in 2D boolean difference
  • Date: Tue, 2 Apr 2019 18:31:55 +0300
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:lkUjqh/803zoxv9uRHKM819IXTAuvvDOBiVQ1KB31+wcTK2v8tzYMVDF4r011RmVBNyds6oP1bWe8/i5HzBZudDZ6DFKWacPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3wOgVvO+v6BJPZgdip2OCu4Z3TZBhDiCagbb9oIxi6sBjdutMKjYd+Jao8yxnEqWZMd+hK2G9kP12ekwvg6suq4JJv7yFcsO89+sBdVqn3Y742RqFCAjQ8NGA16szrtR3dQgaK+3ARTGYYnAdWDgbc9B31UYv/vSX8tupmxSmVJtb2QqwuWTSj9KhkVhnlgzoaOjEj8WHXjstwjL9HoB+kuhdyzZLYbJ2TOfFjeK7WYNEUSndbXstJWCNBDIGzYYsBAeQCIOhWsZXyqkAUoheiHwShHv/jxiNKi3LwwKY00/4hEQbD3AE4ENwOvnXUp8j1OqcVXuC60q3IxijEYvxI1zf96YbIchcuof6SWbJ9asXRyUw1GAPEilWcs5DqPzSQ1ukUtWWQ8uRuVeWqi2E9qgFxpCCixsE2hYbSnY0Vzk7L+T9lz4YyIN20UE97Ydi+EJtRrS6WLYV2QtkkTmp1uyg60qULtYCncCUO0pgqxB7SZ+aaf4WJ4x/vTvudLDV2iX9jZbmxnQy98VK6xe35TsS00EhFri5CktTUs3ACzR3T6syeRvt84ketxC+D1w7O5uxGL004j6XbK5kmwr4/kpocr17PETPxmEXzlKOWd0Mk9fa06+n/fLnqupuRO5V3hwz+KKgih82yDOUiPgQTXWWW9/yw1Lj58k34RLVKgOc2kq7csJ3CO8sbqK+5AwFS0oYs9Rm/Cyyr0NsdnXYdLVJFfAiLgJTuO1HLOPz4F+uwg0ywkDd3wPDLJqHuAprXIXjHibvuYLd961VAxwou1tBf/IlZCqoBIfL2Qk/+rsbUDh4/MwyuwuboEs9x1o0EWTHHP6mCLamHsUOU/vl9ZK6XdYoNsXD8LeIk7rjglzgiiFoFdO6o25UQL3u3F/AjL0SCamf3mYQ9FjIBsQM6CeDrk1afSiV7ZnCoXqt66CtoJpihCNLuSIHlrruO0SPzSpBYZ25BBV2IOXjtfoSAHfwLbXTBcYdajjUYWO35GMca3ha0uVqikus1Hq/v4iQd8Knb+p1w7uzXmws18GUtXcuY2mCJCWpzmzFRHmNk7OVEuUV4j2y7/+1gmfUBTI5c4vpIVkExMpuOl7UnWeC3YRrIe5KycHjjQtiiBmtvHNc4wttLYlokXtv70UuF0C2tDLsY0beMAc5s/w==

The result consists of 2 polygons with holes.
Change
        HPolygon_2 finalPoly(polys[0]);
        CGAL::difference(finalPoly, polys[1], &finalPoly);
to
        std::list<HPolygon_2> res;
        CGAL::difference(pgn1, pgn2, std::back_inserter(res));

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




On Mon, 1 Apr 2019 at 12:03, tfmk <> wrote:
Hello,

I've encountered a crash in a very simple case of 2D boolean operations.
My CGAL version is 5.0 (CGAL_VERSION_NR = 1050000000), but I noticed the
same problem in version 4.7.
To build the project, my CMakeLists.txt contains just the standard
"find_package(CGAL)" as generated by
the cgal_create_CMakeLists script. Adding -frounding-math and/or setting
-O0/-O1/-O2 doesn't help.
I'm using the header-only version of CGAL.
My OS: Ubuntu 16.04 LTS
My compiler: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)

What should I do to prevent this crash? Could this be a bug in CGAL or is my
setup wrong?

Here is the minimal example of a crashing program:

// START OF EXAMPLE
#include <CGAL/Boolean_set_operations_2.h>
#include <CGAL/Polygon_2.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Point_2<Kernel>                             Point_2;
typedef CGAL::Polygon_2<Kernel>                           Polygon_2;
typedef CGAL::Polygon_with_holes_2<Kernel>                HPolygon_2;

int main()
{
        Point_2 points[] = {
                {-0.0541739, -1.74445},
                {-0.820393, -1.08577},
                {-2.83145, -2.79697},
                {0.894224, -0.747698},
                {-1.88305, -1.80022},
                {0.180497, -2.65798},
        };
        Polygon_2 polys[2];
        polys[0].push_back(points[0]);
        polys[0].push_back(points[1]);
        polys[0].push_back(points[2]);
        polys[1].push_back(points[3]);
        polys[1].push_back(points[4]);
        polys[1].push_back(points[5]);

        HPolygon_2 finalPoly(polys[0]);
        CGAL::difference(finalPoly, polys[1], &finalPoly); // CRASHES HERE
        return 0;
}
// END OF EXAMPLE



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss





Archive powered by MHonArc 2.6.18.

Top of Page