Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] random_polygon_2() gets stuck (possible CGAL bug?)

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] random_polygon_2() gets stuck (possible CGAL bug?)


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] random_polygon_2() gets stuck (possible CGAL bug?)
  • Date: Wed, 25 Jun 2014 01:46:15 +0200
  • Organization: GeometryFactory

I confirm that even with exact predicates the algorithm is looping.
Here is a smaller example:
myPoints.push_back(Point_2(0, 0));
myPoints.push_back(Point_2(0, 1));
myPoints.push_back(Point_2(1, 1));
myPoints.push_back(Point_2(1, 0));
myPoints.push_back(Point_2(0.5, 0));
myPoints.push_back(Point_2(0.25, 0));
myPoints.push_back(Point_2(0.15, 0));

the bug appears when several points are aligned along x=cst or y=cst.


Sebastien.


On 06/23/2014 09:35 AM, adrian wrote:
I am using random_polygon_2() in a bigger project to calculate a polygon over
a set of points. Now the program sometimes seems to get stuck in
random_polygon_2 and never returns. In the task manager I see that one onf
the CPU cores is busy. To me this looks like an bug in CGAL, as for other
sets of points it works perfectly fine. Can anybody confirm the problem or
propose a solution?
For smaller sets of points changing the order of points within the list
solved the issue, but that's not a real solution because normally the points
are generated by the program.
I am running the code on Windows 7, 64 bit (compiled for 64 bit) in Visual
Studio 2008.

The coordinates are normally generated in the program, but for simplicity I
made an example where the coordinates are hard coded:

#include <CGAL/Cartesian.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/random_polygon_2.h>

typedef CGAL::Cartesian<double> KP;
typedef KP::Point_2 Point_2;
typedef CGAL::Polygon_2<KP> Polygon_2;

myFunction()
{
std::list<Point_2> myPoints;
Polygon_2 myPolygon;

myPoints.push_back(Point_2(1439.24, -90.5695));
myPoints.push_back(Point_2(1439.24, -90.7099));
myPoints.push_back(Point_2(1439.25, -90.4293));
myPoints.push_back(Point_2(1439.38, -89.2577));
myPoints.push_back(Point_2(1439.24, -90.7242));
myPoints.push_back(Point_2(1439.24, -90.5695));
myPoints.push_back(Point_2(1441.88, -90.5439));
myPoints.push_back(Point_2(1439.24, -90.6255));
myPoints.push_back(Point_2(1439.24, -90.6351));
myPoints.push_back(Point_2(1439.24, -90.5933));
myPoints.push_back(Point_2(1441.59, -91.7365));
myPoints.push_back(Point_2(1441.8, -91.3991));
myPoints.push_back(Point_2(1441.64, -91.7477));
myPoints.push_back(Point_2(1441.8, -91.3991));
myPoints.push_back(Point_2(1439.24, -90.7019));
myPoints.push_back(Point_2(1439.24, -90.7019));
myPoints.push_back(Point_2(1439.24, -90.6819));
myPoints.push_back(Point_2(1439.24, -90.6769));
myPoints.push_back(Point_2(1439.24, -90.6748));
myPoints.push_back(Point_2(1439.24, -90.6709));
myPoints.push_back(Point_2(1439.24, -90.67));
myPoints.push_back(Point_2(1439.24, -90.6678));
myPoints.push_back(Point_2(1439.24, -90.666));
myPoints.push_back(Point_2(1439.24, -90.6634));
myPoints.push_back(Point_2(1439.24, -90.6362));
myPoints.push_back(Point_2(1439.24, -90.6324));
myPoints.push_back(Point_2(1439.24, -90.6299));
myPoints.push_back(Point_2(1439.24, -90.5995));
myPoints.push_back(Point_2(1439.24, -90.5978));
myPoints.push_back(Point_2(1439.54, -89.2892));
myPoints.push_back(Point_2(1441.88, -90.5439));
myPoints.push_back(Point_2(1441.64, -91.7477));

std::cout << "Calculating polygon" << std::endl;
CGAL::random_polygon_2(myPoints.size(), std::back_inserter(myPolygon),
myPoints.begin());
std::cout << "Done calculating polygon" << std::endl;
}



--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/random-polygon-2-gets-stuck-possible-CGAL-bug-tp4659470.html
Sent from the cgal-discuss mailing list archive at Nabble.com.





Archive powered by MHonArc 2.6.18.

Top of Page