Subject: CGAL users discussion list
List archive
- From: "lihw" <>
- To: <>
- Subject: [EMERGENCY] BUG??? DelaunayTriangulation
- Date: Sat, 9 Dec 2006 16:25:12 +0800
Hi, I'm very confusing about this bug. When I try to insert a set of point twice into a deluany
triangulation, a memory exception happens. It is in the very deep of CGAL implementation,
MP_float. Running Environment: VC8.0, MS Windows
XP SP2 Code, point data file and a screenshot
of stack dump are attached. Thanks in advance. |
// lihw
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/assertions.h>
#include <CGAL/Delaunay_Triangulation_3.h>
////////////////////////////////////////////////////////////////////////////////
// Typedefs
//
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Point_3<K> Point;
typedef std::vector<Point> Point_container;
typedef Point_container::iterator Point_iterator;
typedef std::back_insert_iterator<Point_container> Point_inserter;
typedef CGAL::Delaunay_triangulation_3<K> Dt;
void load(const char* file, Point_inserter output_iterator)
{
FILE* fp;
if (fopen_s(&fp, file, "r")) {
printf("can't open %s. Exiting...\n", file);
exit(1);
}
char buffer[1024];
while (fgets(buffer, 1024, fp)) {
// One line contains 4 numbers.
// The first three are coordinates of the point,
// and the last one is a flag indicating continuing
// or not
double x, y, z;
int flag;
sscanf_s(buffer, "%lf %lf %lf %d", &x, &y, &z, &flag);
assert(x <= 1.0f && x >= 0.0f);
assert(y <= 1.0f && y >= 0.0f);
assert(z <= 1.0f && z >= 0.0f);
switch (flag) {
case 2: // ball tensor
*output_iterator++ = Point(x, y, z);
break;
default:
assert(!"not implemented");
break;
}
}
if (ferror(fp)) {
printf("reading %s error. Exiting...\n");
exit(1);
}
fclose(fp);
}
void construct_dt(Point_container& points)
{
Dt dt;
int x, y, z;
x = 0; y = 0; z = 0;
Point_iterator pi, pb = points.begin(), pe = points.end();
for (pi = pb; pi != pe; ++pi) {
Point p(pi->x() + x, pi->y() + y, pi->z() + z);
dt.insert(p);
}
x = 0; y = 0; z = 1;
pb = points.begin(); pe = points.end();
for (pi = pb; pi != pe; ++pi) {
Point p(pi->x() + x, pi->y() + y, pi->z() + z);
dt.insert(p);
}
}
void main(int argc, char* argv[])
{
Point_container points;
points.reserve(256);
if (argc < 2)
exit(1);
load(argv[1], std::back_inserter(points));
construct_dt(points);
return ;
}
Attachment:
1.vw
Description: Binary data
- Visual Studio 2005 (v.8), keith, 12/08/2006
- RE: [cgal-discuss] Visual Studio 2005 (v.8), lihw, 12/08/2006
- Re: [cgal-discuss] Visual Studio 2005 (v.8), Andreas Fabri, 12/08/2006
- Re: [cgal-discuss] Visual Studio 2005 (v.8), Keith Ealanta, 12/08/2006
- Re: [cgal-discuss] Visual Studio 2005 (v.8), Hongbo Fu, 12/08/2006
- Re: [cgal-discuss] Visual Studio 2005 (v.8), Keith Ealanta, 12/09/2006
- HOWTO setup Visual Studio 2005 (v.8) to use CGAL, Keith Ealanta, 12/09/2006
- [EMERGENCY] BUG??? DelaunayTriangulation, lihw, 12/09/2006
- Re: [cgal-discuss] Visual Studio 2005 (v.8), Keith Ealanta, 12/09/2006
- Re: [cgal-discuss] Visual Studio 2005 (v.8), Hongbo Fu, 12/08/2006
- Re: [cgal-discuss] Visual Studio 2005 (v.8), Keith Ealanta, 12/08/2006
Archive powered by MHonArc 2.6.16.