Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] CGAL Intersection Error

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] CGAL Intersection Error


Chronological Thread 
  • From: Eric Berberich <>
  • To:
  • Subject: Re: [cgal-discuss] CGAL Intersection Error
  • Date: Mon, 26 Oct 2009 00:50:49 +0100

Flaminigo wrote:
I use OutputIterator
intersection ( Polygon_2<Kernel, Container> p1,
Polygon_2<Kernel, Container> p2,
OutputIterator oi)
to compute intersection of two polygons. How ever it reports errors when
computing the following two data:

Point data [] = {
Point
(0.0779032708430652393039039793621,0.122371377632631991860812092909
),
Point (13.2581684036192424258615574217,
0.959769766188581341381791389722
),
Point (1.83288664437794701633777094685
,0.617138373712451504538023527857
),
Point (0.693014198934081226965986388677
,0.39778520059801764086060416048
),
Point (0.463650350407879274783340406429
,0.340347544290135750610915010839
),
Point (0.0922023183796141926338307825972,
0.229473196453353733836877381691),
Point( 0.0727179173985912918887208888918
,0.195167801755973285837697517309)
};

Polygon p2(data, data + 4);

Point points_b[] = { Point(0,0), Point(10,0), Point(10,20), Point(0,20)};
Polygon p1 (points_b, points_b+4);

std::ostringstream ostr(std::ostringstream::out);
std::ostream_iterator<Polygon_h> sit = ostr;
intersection(p1, p2, sit);
My kernel is typedef CGAL::Cartesian<double> K;
typedef CGAL::Polygon_2<K>
Polygon;
typedef CGAL::Polygon_with_holes_2<K>
Polygon_h;

The error is
CGAL error: assertion violation!
Expr: *slIter == curve
File: /usr/include/CGAL/Basic_sweep_line_2.h
Line: 675
Explanation:
terminate called after throwing an instance of 'CGAL::Assertion_exception'
what(): CGAL ERROR: assertion violation!
Expr: *slIter == curve
File: /usr/include/CGAL/Basic_sweep_line_2.h
Line: 675
Aborted




doubles are evil for geometry - as we deal with non-continuous functions that are in (near-)degenerate cases (probably here as well) extremely sensitive because of double's rounding.

Please check http://www.cgal.org/philosophy.html or http://www.mpi-inf.mpg.de/~kettner/proj/NonRobust/index.html for the anatomy of 'double' "arithmetic" in geometric settings.

eriC




Archive powered by MHonArc 2.6.16.

Top of Page