Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] 2D Polygon difference asserting in error

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] 2D Polygon difference asserting in error


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] 2D Polygon difference asserting in error
  • Date: Tue, 23 Jul 2013 22:19:01 +0200
  • Organization: GeometryFactory

The first thing to try is to replace

typedef CGAL::Cartesian<Number_type> Kernel;
by
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;

Sebastien.

On 07/23/2013 08:47 PM, Willy Lambert wrote:
Hi all,

I'm quite new to cgal, and I'm trying to use it in robotics path
planning. To do so I create a polygon with holes which show reachable
areas. I initiate a polygon set with the "outer" map and then do a
difference with each obstacles thougth eating borders of the map or
creating an hole.

It is working for many obstacles except one, which is asserting when I
do the difference. I didn't used cgal enougth to be able to find if it
is a cgal bug or a mis-use so I'm asking some help here to clarify this.

Here is a simple code to reproduce :

typedef float Number_type;
typedef CGAL::Cartesian<Number_type> Kernel;
typedef Kernel::Point_2 Point_2;
typedef CGAL::Polygon_2<Kernel> Polygon_2;
typedef CGAL::Polygon_with_holes_2<Kernel> Polygon_with_holes_2;
typedef CGAL::Polygon_set_2<Kernel> Polygon_set_2;

Polygon_2 A,B;

A.push_back(Point_2(1350, -850));
A.push_back(Point_2(1350, 850));
A.push_back(Point_2(-1350, -850));

B.push_back(Point_2(1003, -116));
B.push_back(Point_2(947, -251));
B.push_back(Point_2(984, -1000));

Polygon_set_2 S;
S.insert(A);
S.difference(B);


It compiles and throw at execution :

(atlantronic) robot@ard-host ~/workspace/test_cgal/Debug $ ./test_cgal
terminate called after throwing an instance of
'CGAL::Precondition_exception'
what(): CGAL ERROR: precondition violation!
Expr: comp_f(object, parentP->object) != SMALLER
File: /home/robot/workspace/CGAL-4.2/include/CGAL/Multiset.h
Line: 2129
Aborted (core dumped)

Here is a screen shot if it can help visualizing the problem.
http://cgal-discuss.949826.n4.nabble.com/file/n4657830/cgal_problem.png


Let me know if you need any further information or if I need to
re-formulate my demand which standard debug information set.

Regards.





Archive powered by MHonArc 2.6.18.

Top of Page