Skip to Content.
Sympa Menu

cgal-discuss - RE: [cgal-discuss] a bug in DeluanayTriangulation_3?

Subject: CGAL users discussion list

List archive

RE: [cgal-discuss] a bug in DeluanayTriangulation_3?


Chronological Thread 
  • From: "lihw" <>
  • To: <>
  • Subject: RE: [cgal-discuss] a bug in DeluanayTriangulation_3?
  • Date: Fri, 1 Dec 2006 12:42:08 +0800

Thanks for replying.

After correcting the typos, I find that it I need to use release version of
cgal.lib instead of the debug version, then I can go through.



-----Original Message-----
From: Andreas Fabri
[mailto:]

Sent: Friday, December 01, 2006 4:45 AM
To:

Subject: Re: [cgal-discuss] a bug in DeluanayTriangulation_3?

Hello,

I can't reproduce it, neither in debug nor in release mode.
It also worked with or without -D_HAS_ITERATOR_DEBUGGING=0
to switch off the stronger checking in the new STL
of VC8.


Note that you do not insert translated points

Instead of
Point (pi->x() + x, pi->y() + y, pi->z() + z);
dt.insert(*pi);

you probably want this:

Point point(pi->x() + x, pi->y() + y, pi->z() + z);
dt.insert(point);


andreas

lihw wrote:
> Hi, all
>
>
>
> I came across a confusing problem when I try to construct a Delaunay
> Triangulation 3D.
>
>
>
> I have about 256 points distributed in [0,1] x [0,1] x [0,1]. First I
> construct an Delaunay triangulation using these points. Then I add an
> offset that is [0, 0, 1] to these points and insert the new points to
> the initial triangulation. A memory exception comes out in every deep
> call stack, "memcpy.dll".
>
>
>
> I compile the source in VC2005. Is there anyone once seeing the same
> problem? Please leave me a hint.
>
>
>
> I attached the source file and data to the email. They are plain text
> and I promise it is free of virus. Please take a look at it and help me.
>
>
>
> Thanks in advance.
>
>
>
> lihw
>
>
> ------------------------------------------------------------------------
>
> // mr.cpp
> // 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_exact_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 (pi->x() + x, pi->y() + y, pi->z() + z);
> dt.insert(*pi);
> }
>
> x = 0; y = 0; z = 1;
> pb = points.begin(); pe = points.end();
> for (pi = pb; pi != pe; ++pi) {
> Point (pi->x() + x, pi->y() + y, pi->z() + z);
> dt.insert(*pi);
> }
> }
>
> 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);
> }
>




  • RE: [cgal-discuss] a bug in DeluanayTriangulation_3?, lihw, 12/01/2006

Archive powered by MHonArc 2.6.16.

Top of Page