Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] segment fault of boolean 2D on 64 bit linux

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] segment fault of boolean 2D on 64 bit linux


Chronological Thread 
  • From: Hyungon Kim <>
  • To:
  • Cc: Jinsong Zhao <>, Liang Tao <>
  • Subject: Re: [cgal-discuss] segment fault of boolean 2D on 64 bit linux
  • Date: Mon, 27 Apr 2009 18:11:45 -0700

Hi Andres,

Attached you will see exam.cpp which would crash in 64bit linux.

Thanks,
Hyungon Kim

Hyungon Kim wrote:
Hi Andreas,

I did not yet check with 3.4.
I suppose that I can make a test program after couple of days.

Thanks,
Hyungon Kim

Andreas Fabri wrote:

wrote:
Hi,

Boolean operation with Polygon_set_2 or Nef_polyhedron_2 from CGAL-3.3.1 is
fine on 32 bit linux, but crashed on 64 bit. I use lazy_exact_nt<Gmpq> as
kernel. Is it possible that 64 bit compiled one is different from 32 bit one?
Would you tell me the possible causes? or Is there a way to catch this
exceptional case?

Thanks,
Hyungon Kim


It is rather astonishing that BOTH packages fail.

Can you send us a small test program and a data set in order to investigate.

Did you also check with CGAL 3.4

Best regards,

andreas


#include <iostream>
#include <list>
#include <vector>
using namespace std;

#include <CGAL/basic.h>
#include <CGAL/Gmpq.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Lazy_exact_nt.h>
#include <CGAL/Bounded_kernel.h>
#include <CGAL/Nef_polyhedron_2.h>
#include <CGAL/Polygon_2.h>

typedef CGAL::Simple_cartesian<CGAL::Lazy_exact_nt<CGAL::Gmpq> > Kernel;
typedef CGAL::Bounded_kernel<Kernel> Extended_kernel;
typedef CGAL::Nef_polyhedron_2<Extended_kernel> Nef_polyhedron;
typedef Nef_polyhedron::Point Point;
typedef CGAL::Polygon_2<Kernel> Polygon_2;

void dumpNefPolyhedron(const Nef_polyhedron& plane);

int
main()
{
vector<Point> P1;
P1.push_back(Point(CGAL::Gmpq("7888441083265167/36893488147419103232"),
CGAL::Gmpq("8779783034540329/36893488147419103232")));
P1.push_back(Point(CGAL::Gmpq("3974876669099847/18446744073709551616"),
CGAL::Gmpq("4406261305535127/18446744073709551616")));
P1.push_back(Point(CGAL::Gmpq("3974876669099847/18446744073709551616"),
CGAL::Gmpq("4422671529063099/18446744073709551616")));
P1.push_back(Point(CGAL::Gmpq("7805610775155633/36893488147419103232"),
CGAL::Gmpq("4422671529063099/18446744073709551616")));
P1.push_back(Point(CGAL::Gmpq("7805610775155633/36893488147419103232"),
CGAL::Gmpq("8779783034540329/36893488147419103232")));
Polygon_2 poly1(P1.begin(), P1.end());

vector<Point> P2;
P2.push_back(Point(CGAL::Gmpq("7857704380419789/36893488147419103232"),
CGAL::Gmpq("8679059679827203/36893488147419103232")));

P2.push_back(Point(CGAL::Gmpq("26721876756368752824653411611/125206972526865090683066508115968"),
CGAL::Gmpq("8648755958958723/36893488147419103232")));
P2.push_back(Point(CGAL::Gmpq("8264381005120885/36893488147419103232"),
CGAL::Gmpq("8648755958958723/36893488147419103232")));
P2.push_back(Point(CGAL::Gmpq("8264381005120885/36893488147419103232"),
CGAL::Gmpq("4422819103015689/18446744073709551616")));
P2.push_back(Point(CGAL::Gmpq("4005606878691311/18446744073709551616"),
CGAL::Gmpq("4422819103015689/18446744073709551616")));
P2.push_back(Point(CGAL::Gmpq("7857704380419789/36893488147419103232"),
CGAL::Gmpq("8763601845786777/36893488147419103232")));
Polygon_2 poly2(P2.begin(), P2.end());

Nef_polyhedron N1(poly1.vertices_begin(), poly1.vertices_end(),
Nef_polyhedron::INCLUDED);
Nef_polyhedron N2(poly2.vertices_begin(), poly2.vertices_end(),
Nef_polyhedron::INCLUDED);
Nef_polyhedron N3 = N1 + N2;

dumpNefPolyhedron(N3);

return 0;
}

typedef Nef_polyhedron::Explorer cgalExplorer;
typedef cgalExplorer::Face_const_iterator
cgalFaceConstIterator;
typedef cgalExplorer::Hole_const_iterator
cgalHoleConstIterator;
typedef cgalExplorer::Halfedge_around_face_const_circulator
cgalHalfFaceConstCirculator;
typedef cgalExplorer::Vertex_const_handle
cgalVertexConstHandle;

void
dumpNefPolyhedron(const Nef_polyhedron& plane)
{
cout << "print_Nef_polyhedron:" << endl;

cgalExplorer explorer = plane.explorer();
cgalFaceConstIterator fit = explorer.faces_begin();
cout << "explorer.mark(explorer.faces_begin()) "
<< ((explorer.mark(fit)) ? "is part of polygon" : "is not part of
polygon") << endl;
for (cgalHoleConstIterator hit = explorer.holes_begin(fit);
hit != explorer.holes_end(fit); hit++) {
cout << " A hole" << endl;
cgalHalfFaceConstCirculator hafc(hit), done(hit);
do {
cgalVertexConstHandle vh = explorer.target(hafc);
//cout << explorer.point(vh) <<" [" <<
explorer.point(vh).x().exact()
// << " | " << explorer.point(vh).y().exact() << "], " ;
cout << explorer.point(vh) <<" [" << explorer.point(vh).x()
<< " | " << explorer.point(vh).y() << "], " ;
hafc++;
} while(hafc != done);
cout << endl;
}
for (fit++; fit != explorer.faces_end(); fit++){
cgalHalfFaceConstCirculator hafc = explorer.face_cycle(fit),
done(hafc);
cout << "face: " << ((explorer.mark(fit)) ? "is part of polygon" :
"is not part of polygon") << endl;
do {
cgalVertexConstHandle vh = explorer.target(hafc);
//cout << explorer.point(vh) << " [" <<
explorer.point(vh).x().exact()
// << " | " << explorer.point(vh).y().exact() << "], " ;
cout << explorer.point(vh) << " [" << explorer.point(vh).x()
<< " | " << explorer.point(vh).y() << "], " ;
hafc++;
} while(hafc != done);
cout << endl;

for (cgalHoleConstIterator hit = explorer.holes_begin(fit);
hit != explorer.holes_end(fit); hit++){
cout << " A hole" << endl;
cgalHalfFaceConstCirculator hafc(hit), done(hit);
do {
cgalVertexConstHandle vh = explorer.target(hafc);
//cout << explorer.point(vh) << " [" <<
explorer.point(vh).x().exact()
// << " | " << explorer.point(vh).y().exact() << "], " ;
cout << explorer.point(vh) << " [" << explorer.point(vh).x()
<< " | " << explorer.point(vh).y() << "], " ;
hafc++;
} while(hafc != done);
cout << endl;
}
}
}


  • Re: [cgal-discuss] segment fault of boolean 2D on 64 bit linux, Hyungon Kim, 04/28/2009

Archive powered by MHonArc 2.6.16.

Top of Page