Subject: CGAL users discussion list
List archive
- From: Bernhard Kornberger <>
- To:
- Subject: Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3
- Date: Tue, 31 Jul 2007 14:35:52 +0200
schrieb:
I had a quicklook at your files and they are not easy to read...
could you better isolate the problem?
In your first test, it seems that the program crashes only AFTER the triangulation is built ("Starting Postprocessing..."), right?
best
Monique
Thank you for the answer. I had a closer look at the problem and it
seems that what I have reported are actually two different problems.
The first problem:
==================
The first problem is the crash when no debugger is used. It is not
related to Regular_Triangulation_3 but to the convex hull. I was able
to generate a really small example where something bad happens:
CopyPaste:
###########################################################
bkorn@pepper:~/spheres_dev/test
$ cat minkowski.cpp
#include <iostream>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Filtered_kernel.h>
#include <CGAL/Convex_hull_d.h>
#include <CGAL/Convex_hull_d_traits_3.h>
#include <CGAL/Convex_hull_d_to_polyhedron_3.h>
using namespace std;
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
// Convex hull
typedef CGAL::Convex_hull_d_traits_3<K> Hull_traits_3;
typedef CGAL::Convex_hull_d< Hull_traits_3 > Convex_hull_3;
typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef Polyhedron::Facet_iterator PFacet_iterator;
typedef K::Point_3 Point;
int main(int argc, char *argv[])
{
Convex_hull_3 cHull(3);
cHull.insert(Point(0,0,0));
cHull.insert(Point(0,0,1));
cHull.insert(Point(0,1,0));
cHull.insert(Point(1,0,0));
Polyhedron poly;
CGAL::convex_hull_d_to_polyhedron_3(cHull,poly);
cout << "Now we show the cHull's planes"<<endl;
for(PFacet_iterator f_it=poly.facets_begin();f_it!=poly.facets_end();++f_it)
{
cout << "facet_degree="<<f_it->facet_degree()<<endl;
cout << "plane="<<f_it->plane()<<endl;
}
}
###########################################################
This is the program's output:
CopyPaste:
###########################################################
bkorn@pepper:~/spheres_dev/test
$ ./minkowski
Now we show the cHull's planes
facet_degree=3
plane=0 0 0 0
facet_degree=3
plane=0 0 0 0
facet_degree=3
plane=0 0 0 0
facet_degree=3
plane=0 0 0 0
###########################################################
Probably I've used the convex hull in a wrong way and the error is
that I should have inserted Point_d points, right? But then I would
expect an error from the compiler or at least an assertion instead
of invalid planes that lead to errors somewhere else.
The second problem:
===================
The second problem occurs only when the software runs in the valgrind
debugger. It is indeed related to Regular_Triangulation_3. I have
simplified the code I gave you last time:
The main routine calls the Triangulator's constructor:
CopyPaste:
###########################################################
int main(int argc, char *argv[])
{
Triangulator* powerDiagram=new Triangulator();
return 0;
}
###########################################################
This is the constructor:
CopyPaste:
###########################################################
Triangulator::Triangulator()
{
cout << "Triangulator: inserting 8 bounding spheres"<<endl;
double l=-2396.4;
double u=2595.59;
vBoundingVertices.insert(regTr.insert(Weighted_point(Point(l,l,l,1))));
cout << "a"<<endl;
vBoundingVertices.insert(regTr.insert(Weighted_point(Point(l,l,u,1))));
cout << "b"<<endl;
vBoundingVertices.insert(regTr.insert(Weighted_point(Point(l,u,l,1))));
cout << "c"<<endl;
vBoundingVertices.insert(regTr.insert(Weighted_point(Point(l,u,u,1))));
cout << "d"<<endl;
vBoundingVertices.insert(regTr.insert(Weighted_point(Point(u,l,l,1))));
cout << "e"<<endl;
vBoundingVertices.insert(regTr.insert(Weighted_point(Point(u,l,u,1))));
cout << "f"<<endl;
vBoundingVertices.insert(regTr.insert(Weighted_point(Point(u,u,l,1))));
cout << "g"<<endl;
vBoundingVertices.insert(regTr.insert(Weighted_point(Point(u,u,u,1))));
cout << "h"<<endl;
}
###########################################################
Here is the output if NO debugger is used:
CopyPaste:
###########################################################
./minkowski
/usr/bin/g++ -o minkowski minkowski.o Triangulator.o UnionOfSpheres.o VisualizerGV.o -lm -ldl -pg '-L/opt/CGAL330/lib' -L/usr/lib/qt3 -Wl,-R/opt/CGAL330/lib/i686_Linux-2.6_g++-4.1.2:/usr/lib/qt3 -lCGAL -lCGALcore++ -lCGALQt -lCGALimageIO -lCGALPDB -lqt-mt -lGL -lGLU -lz -lmpfr -lgmpxx -lgmp -lX11 -lboost_program_options -lm
Triangulator: inserting 8 bounding spheres
a
b
c
d
e
f
g
h
###########################################################
..everything is okay. But if a debugger is used:
CopyPaste:
###########################################################
valgrind ./minkowski
/usr/bin/g++ -o minkowski minkowski.o Triangulator.o UnionOfSpheres.o VisualizerGV.o -lm -ldl -pg '-L/opt/CGAL330/lib' -L/usr/lib/qt3 -Wl,-R/opt/CGAL330/lib/i686_Linux-2.6_g++-4.1.2:/usr/lib/qt3 -lCGAL -lCGALcore++ -lCGALQt -lCGALimageIO -lCGALPDB -lqt-mt -lGL -lGLU -lz -lmpfr -lgmpxx -lgmp -lX11 -lboost_program_options -lm
==9568== Memcheck, a memory error detector.
==9568== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al.
==9568== Using LibVEX rev 1658, a library for dynamic binary translation.
==9568== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
==9568== Using valgrind-3.2.1-Debian, a dynamic binary instrumentation framework.
==9568== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al.
==9568== For more details, rerun with: -v
==9568==
Triangulator: inserting 8 bounding spheres
a
b
c
d
e
f
CGAL error: precondition violation!
Expr: orientation(p0, p1, p2, p3) == POSITIVE
File: /opt/CGAL330/include/CGAL/Regular_triangulation_3.h
Line: 890
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
==9568==
==9568== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 97 from 1)
==9568== malloc/free: in use at exit: 1,125,702 bytes in 531 blocks.
==9568== malloc/free: 578 allocs, 47 frees, 1,128,077 bytes allocated.
==9568== For counts of detected errors, rerun with: -v
==9568== searching for pointers to 531 not-freed blocks.
==9568== checked 2,180,184 bytes.
==9568==
==9568== LEAK SUMMARY:
==9568== definitely lost: 0 bytes in 0 blocks.
==9568== possibly lost: 149 bytes in 4 blocks.
==9568== still reachable: 1,125,553 bytes in 527 blocks.
==9568== suppressed: 0 bytes in 0 blocks.
==9568== Reachable blocks (those to which a pointer was found) are not shown.
==9568== To see them, rerun with: --show-reachable=yes
Aborted (core dumped)
###########################################################
You can download this simplified example here:
http://dist.ist.tugraz.at/test2.tar.bz2
Best regards
Bernhard
- Regular_triangulation_3 Bug, CGAL 3.3, Bernhard Kornberger, 07/30/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Monique . Teillaud, 07/30/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Bernhard Kornberger, 07/31/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Andreas Fabri, 07/31/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Bernhard Kornberger, 07/31/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Monique . Teillaud, 07/31/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Andreas Fabri, 07/31/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Bernhard Kornberger, 07/31/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Camille Wormser, 07/31/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Andreas Fabri, 07/31/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Camille Wormser, 07/31/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Andreas Fabri, 07/31/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Bernhard Kornberger, 07/31/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Andreas Fabri, 07/31/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Bernhard Kornberger, 07/31/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Monique . Teillaud, 07/30/2007
Archive powered by MHonArc 2.6.16.