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: 王进 <>
  • To:
  • Subject: Re:[cgal-discuss] Constrained_triangulation_plus_2 may crashed when insert_vertex_in_constraint called!
  • Date: Fri, 28 Apr 2017 09:53:12 +0800 (CST)
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:5qV4uhNL5lggciWcpSgl6mtUPXoX/o7sNwtQ0KIMzox0LfT7rarrMEGX3/hxlliBBdydsKMYzbKO+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZPebgFHiTanfb9+MAi9oBnMuMURnYZsMLs6xAHTontPdeRWxGdoKkyWkh3h+Mq+/4Nt/jpJtf45+MFOTav1f6IjTbxFFzsmKHw65NfqtRbYUwSC4GYXX3gMnRpJBwjF6wz6Xov0vyDnuOdxxDWWMMvrRr0yRD+s7bpkSAXwhScGOTA38H/ZhNFqgqxcoh2hqQBwzIHXboyOLvVyYrnQcsgASGZdQshcUTFKDIOmb4sICuoMJelet4z9okMWsBCzAgetBOLpyjJGmHP5wLM13P88EQHJxwEsAtMDvXrOoNrpM6cSVPm4wa/VxjvNaPNW3C3y6InOch05oPGMW6hwccvLxkU1GQPFlFOdopHmMTONzukBrXaX4/Z6We6yiGMrtht9riWhy8s2l4XFmoMYxkjE+Ch92oo5ON+1RU5hbdK5E5ZcqzuWO5Z1T84kXmpmojw1yqcctp6+ZCUKyIooxxrYa/GfdoiE/xzuWP+MLTtkhX9pYq+zihe8/ES61uL8Ucy03E5LripDjNbMqmgA2wLN5sSbUPdx40Ss1SuV2wzO5OxIO104mbbaJpI5x74/jJsTsUDNHi/sn0X2ibebd0sl+uiu5enrfKjpqYGHOI9phQHzKbkil82xDOgiLgcOWG2b9fym1LL/5U35XKlKjvoun6bFv5DVP8AbqrekDA9UyYYs9wu/Dyy90NkDhnkGLFdFeAqdgITzOlHOJur4DfaljFi2njdr3aOOA7v6H5+YLmTfiKyzOvFm+ktEwUwyy8pe7tRaEPYaMffrUwjwstLfSRQ2Ogjxz+f8A8hmzdAiXjeEDaadda/TqlSV/fkHIu+WZYZTtiyuBeIi4qtLEKqp0QsCfK/yh5caYm23Nq04eAOSZn+60YRJKnsDogdrFL+is1aFSzMGP3s=

hi Sebastien, thanks for your replay!

in the documentation 

  // Inserts vh before pos
  // Returns an iterator pointing on the newly inserted vertex
  // Writes the modified faces to out
  template <class OutputIterator>
  Vertices_in_constraint_iterator
  insert_vertex_in_constraint(Constraint_id cid, Vertices_in_constraint_iterator pos, 
     Vertex_handle vh, OutputIterator out)
  { ...}

this operation is same as stl list insert operation,the follow code had handled iterator to keep validated

vb = cdtp.insert_vertex_in_constraint(*cid, vb, W);
vb++;
and the example  procedure is not everytime crashed,maybe 5-10% chance.

WangJin


At 2017-04-27 15:15:05, "Sebastien Loriot (GeometryFactory)" <> wrote: >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 >> >> >> >> >> >> > > >-- >You are currently subscribed to cgal-discuss. >To unsubscribe or access the archives, go to >https://sympa.inria.fr/sympa/info/cgal-discuss > >


 




Archive powered by MHonArc 2.6.18.

Top of Page