Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Why does this set of polygons cause CGAL::join to crash?

Subject: CGAL users discussion list

List archive

[cgal-discuss] Why does this set of polygons cause CGAL::join to crash?


Chronological Thread 
  • From: Steven <>
  • To:
  • Subject: [cgal-discuss] Why does this set of polygons cause CGAL::join to crash?
  • Date: Mon, 11 May 2015 17:33:09 -0700 (PDT)

Using CGAL 4.5.2. Below sample causes a bunch of precondition violations,
followed by an access violation exception. The funny thing is that if you
remove any of the 6 polygons from the input, everything runs fine. Why is
this happening?

The only unusual thing about the polygons that I can see is that poly6 has a
duplicate point - but it is not self-intersecting, only touching, so I
believe this shouldn't be a problem? And as said above, when you remove any
of the other polygons, this polygon can be handled just fine.

Is there a bug somewhere? Or is something wrong with my input?

------------

typedef CGAL::Exact_predicates_exact_constructions_kernel Knl;
typedef CGAL::Polygon_with_holes_2<Knl> Polygon_with_holes;
typedef CGAL::Polygon_2<Knl> Polygon;

int main(int argc, char* argv[])
{
std::list<Polygon> polys;

Polygon poly1;
poly1.push_back(Point_2(417340.5, 523797.5));
poly1.push_back(Point_2(419348.3269736591, 508552.92065337556));
poly1.push_back(Point_2(421866.5, 489433.5));
poly1.push_back(Point_2(421865.5, 489447.5));
poly1.push_back(Point_2(417342.43500051671, 523783.40213909268));
poly1.push_back(Point_2(417341.5, 523790.5));
polys.push_back(poly1);

Polygon poly2;
poly2.push_back(Point_2(417342.43500051671, 523783.40213909268));
poly2.push_back(Point_2(421865.5, 489447.5));
poly2.push_back(Point_2(421837.5, 489724.5));
poly2.push_back(Point_2(417365.15018218826, 523612.759577192));
poly2.push_back(Point_2(417347.5, 523746.5));
poly2.push_back(Point_2(417346.5, 523753.5));
poly2.push_back(Point_2(417344, 523772));
poly2.push_back(Point_2(417342.74397163116, 523781.15106382978));
polys.push_back(poly2);

Polygon poly3;
poly3.push_back(Point_2(421837.5, 489724.5));
poly3.push_back(Point_2(421832.5, 489771.5));
poly3.push_back(Point_2(421831.5, 489780.5));
poly3.push_back(Point_2(417365.84675276978, 523607.52457525046));
polys.push_back(poly3);

Polygon poly4;
poly4.push_back(Point_2(421831.5, 489780.5));
poly4.push_back(Point_2(421830.5, 489794.5));
poly4.push_back(Point_2(417366.29927861993, 523604.12366546877));
polys.push_back(poly4);

Polygon poly5;
poly5.push_back(Point_2(417322.5, 523931.5));
poly5.push_back(Point_2(417318.5, 523966.5));
poly5.push_back(Point_2(417317.5, 523968.5));
polys.push_back(poly5);

Polygon poly6;
poly6.push_back(Point_2(417344, 523772));
poly6.push_back(Point_2(417346.5, 523753.5));
poly6.push_back(Point_2(417346.72222222225, 523752.16666666663));
poly6.push_back(Point_2(417347.5, 523746.5));
poly6.push_back(Point_2(417366.29927861993, 523604.12366546877));
poly6.push_back(Point_2(421830.5, 489794.5));
poly6.push_back(Point_2(421802.5, 490071.5));
poly6.push_back(Point_2(417411.35391183395, 523265.52037297864));
poly6.push_back(Point_2(417359.5, 523657.5));
poly6.push_back(Point_2(417358.5, 523664.5));
poly6.push_back(Point_2(417355.28571428568, 523688.92857142852));
poly6.push_back(Point_2(417353.5, 523702.5));
poly6.push_back(Point_2(417352.5, 523709.5));
poly6.push_back(Point_2(417347.5, 523746.5));
poly6.push_back(Point_2(417347.5, 523747.5));
poly6.push_back(Point_2(417346.72222222225, 523752.16666666663));
poly6.push_back(Point_2(417346.33333333337, 523755));
polys.push_back(poly6);

list<Polygon_with_holes> polyHoles;
CGAL::join(polys.begin(), polys.end(),
std::back_inserter(polyHoles));
}



--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Why-does-this-set-of-polygons-cause-CGAL-join-to-crash-tp4660815.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page