Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Constrained_triangulation_plus_2 may crashed when insert_vertex_in_constraint called!

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Constrained_triangulation_plus_2 may crashed when insert_vertex_in_constraint called!


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Constrained_triangulation_plus_2 may crashed when insert_vertex_in_constraint called!
  • Date: Thu, 27 Apr 2017 09:15:05 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:b++rrh1ShFK7Xj/psmDT+DRfVm0co7zxezQtwd8ZseIWLfad9pjvdHbS+e9qxAeQG96Kt7Qc06L/iOPJYSQ4+5GPsXQPItRndiQuroEopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZvJuTyB4Xek9m72/q89pDXbAhEniaxba9vJxiqsAvdsdUbj5F/Iagr0BvJpXVIe+VSxWx2IF+Yggjx6MSt8pN96ipco/0u+dJOXqX8ZKQ4UKdXDC86PGAv5c3krgfMQA2S7XYBSGoWkx5IAw/Y7BHmW5r6ryX3uvZh1CScIMb7S60/Vza/4KdxUBLmlTkJNzA5/mHQicJ+gqxUrx2jqBNjzIDZe52VOflkc6/BYd8XS3ZPU8BMXCJBGIO8aI4PAvIPMehFsYbyvEEBrQCiBQmtGuzvzCJDiHnx3a0g0uQhFh3G1xEkE9wPrnvUq9D1O7kOUeCvzKjGzS/MYO9K2Tf68ojJchUtrf+RVr93asrRzU4vFxnEjlWXtYzpJTaV1uAWvmiU6upvT+Ovi2o9pw5tpTivw94hh4/UjYwW0lDJ7Sd0zYkvKdGlVkJ2YcSoHZhOuy2AOIZ6XNsuTmNrtSog1LELtp+2cDIXxJkjyRPTcf6KfoiO7xn+TuieOy14i2hgeL+nhxa970ygyurkW8mxyllKry5FnsDCt3AIyxDf88aHR/Rj8ku71jaP0AfT6u5AIU8qj6bUN5khwrsompoSt0TMADP2lV30gaKZbEko5/ak5uT9brjluJOQLYB5hh/mPqQrgMO/AOA4MgYUX2ic/OSxzKbj/Un+QLVQj/02lbXZvIrfJcQfvaO5DApV3Zwi6xa7FTupzNMYnXwfIFJfZB2Hl5TpO03JIP3gEfi/jE6jkDNyy//bP73hGYnCLmXYkLf6Zrt98E5dyA8rzd9F/Z5UC7cBIOjyWkDrrtDYAAU5YESIxLPsB9x5k48fQmmSGbSxMaXIsFbO6Ph8DfOLYdpfgzv3IuM55vPoxVs+g14aYeHp8pYQbX2kBOVIKk6FZmD9w51JRXwOuRA/S/CsjVmqXjtaZnL0VKU5sGJoQLm6BJvOE9j+yIeK2z22S8Vb
  • Organization: GeometryFactory

Note that you are iterating over constrained edges and in the same loop you modify the set
of constrained edges. This is invalidating the iterator you are using.

Sebastien.

On 04/27/2017 08:54 AM, 王进 wrote:
hi all, I found Constrained_triangulation_plus_2 may crashed when
insert_vertex_in_constraint called
my codes:

#include <CGAL/basic.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_hierarchy_2.h>
#include <CGAL/Constrained_triangulation_plus_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Exact_predicates_tag ITAG;
typedef CGAL::Triangulation_vertex_base_2<K> TVBB;
typedef CGAL::Triangulation_hierarchy_vertex_base_2<TVBB> TVB;
typedef CGAL::Constrained_triangulation_face_base_2<K> TFB;
typedef CGAL::Triangulation_data_structure_2<TVB, TFB> TDS;
typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, ITAG> CDT;
typedef CGAL::Triangulation_hierarchy_2<CDT> CDTH;
typedef CGAL::Constrained_triangulation_plus_2<CDTH> CDTP;

typedef CGAL::Polygon_2<K> Polygon_2;
typedef CDTP::Point Point_2;
typedef CDTP::Vertex_handle Vertex_handle;
typedef CDTP::Constraint_id Constraint_id;
typedef CDTP::Constraint_iterator Constraint_iterator;
typedef CDTP::Vertices_in_constraint_iterator
Vertices_in_constraint_iterator;

#include "vector4.hpp"
#include "Matrix4.hpp"
#include "Math.hpp"
int main() {
Polygon_2 polygon;
polygon.push_back(Point_2(0.00000000000000000, 71.289788474561647));
polygon.push_back(Point_2(42.553236484178342, 71.993132446252275));
polygon.push_back(Point_2(43.293765253096353, 0.70334397174883634));
polygon.push_back(Point_2(0.74052876897621900, 0.00000000000000000));
polygon.push_back(Point_2(0.00000000000000000, 71.289788474561647));

Point_2 p1(21.520543956896290, 71.645492202660535);
Point_2 p2(22.262916839332320, 0.35573420871514827);
Point_2 p3(21.520543956896290, 71.645492202660535);
CDTP cdtp;
Constraint_id id = cdtp.insert_constraint(polygon.vertices_begin(),
polygon.vertices_end(), false);
int todo = 1;
for (Constraint_iterator cid = cdtp.constraints_begin(); cid !=
cdtp.constraints_end(); cid++) {
Vertices_in_constraint_iterator vb =
cdtp.vertices_in_constraint_begin(*cid);
if (vb == cdtp.vertices_in_constraint_end(*cid)) continue;
Vertex_handle P = *vb; vb++;
if (vb == cdtp.vertices_in_constraint_end(*cid)) continue;

for (; vb != cdtp.vertices_in_constraint_end(*cid); vb++) {
Vertex_handle Q = *vb;
if (todo)
{
//Vertex_handle W = cdtp.insert(Point_2(p1.x(),p1.y()));
Vertex_handle W = cdtp.insert(p1);
vb = cdtp.insert_vertex_in_constraint(*cid, vb, W);
P = Q;
vb++;
todo = 0;
}

//std::cout << P->point().x() << " " << P->point().y();// << " " <<
Q->point().x() << " " << Q->point().y() << std::endl;
}
}
return 0;
}

I use Visual Studio 2015(update3) + CGAL-4.7(static library)
something wrong?

thanks for your help!

WangJin










Archive powered by MHonArc 2.6.18.

Top of Page