Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Convex_hull_d wrong usage or bug?

Subject: CGAL users discussion list

List archive

[cgal-discuss] Convex_hull_d wrong usage or bug?


Chronological Thread 
  • From: stfu <>
  • To:
  • Subject: [cgal-discuss] Convex_hull_d wrong usage or bug?
  • Date: Thu, 18 Sep 2014 13:28:38 -0700 (PDT)

Hi all,
we have an application where we need to determine the vertices of a convex
hull in moderate dimensions (d<=50) and tried the Convex_hull_d code from
CGAL.

The following program unfortunately crashes with a segmentation fault, e.g.
when trying to insert 1000 points in 10 dimensions after insertion of about
40 points:


===================================
#include <iostream>
//#include <CGAL/Cartesian_d.h>
#include <CGAL/Homogeneous_d.h>
#include <CGAL/Convex_hull_d.h>
//#include <CGAL/double.h>
//#include <CGAL/MP_Float.h>
#include <CGAL/Gmpz.h>
//#include <CGAL/Gmpq.h>



typedef CGAL::Homogeneous_d<CGAL::Gmpz> DCKernel;
//typedef CGAL::Cartesian_d<CGAL::Gmpq> DCKernel;

typedef DCKernel::Point_d Point_d;


using namespace std;


int main(int argc, char *argv[])
{
if (argc<3)
{
cout<<"Usage: ch_d-crash <nofpoints> <dimension>"<<endl;
exit(0);
}
int nofPoints=atoi(argv[1]);
int dimension=atoi(argv[2]);

CGAL::Convex_hull_d&lt;DCKernel> myCHD(dimension);

for(int j=0; j<nofPoints; j++)
{
// create coords
vector&lt;int> coords;
for(int d=0; d<dimension; d++)
{
coords.push_back(rand()%100000);
}
myCHD.insert(Point_d(dimension, coords.begin(),
coords.end()));
cout<<"."<<flush;
if (j%10==0)
cout<<" "<<j<<" "<<flush;
}
cout<<endl;

return 0;
}
=======================

By employing an exact kernel we should not experience robustness problems,
right?
Or is there a really stupid mistake in our above code?

BTW for small dimensions (e.g. d=3) it seems more stable and does not crash
as quickly. Tested on cgal 4.2 as included with Ubuntu 13.10 and 14.04 on an
intel x86 system (64-bit).

I hope we did not make a too obvious mistake here ...

Many thanks for your time,
-Stefan




--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Convex-hull-d-wrong-usage-or-bug-tp4659852.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page