From e571639c94ca9fad0a68440f5811feb13b312e2d Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Thu, 20 Oct 2016 15:20:13 -0400 Subject: [PATCH] Continue to work on LCC operations for CMap and GMap... --- .../include/CGAL/Combinatorial_map.h | 13 ++++++-- .../include/CGAL/Generalized_map.h | 31 ++++++++++++++----- .../include/CGAL/Linear_cell_complex_base.h | 7 +++-- .../CGAL/Linear_cell_complex_constructors.h | 6 ++-- 4 files changed, 41 insertions(+), 16 deletions(-) diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index 6f7200c1ac4..5a2af1c1c22 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -3801,9 +3801,12 @@ namespace CGAL { } /** Create an edge. + * if closed==true, the edge has no 2-free dart. + * (note that for CMap there is no differente between true and false, but + * this is not the case for GMap) * @return a dart of the new edge. */ - Dart_handle make_edge() + Dart_handle make_edge(bool /*closed*/=false) { Dart_handle d1 = create_dart(); Dart_handle d2 = create_dart(); @@ -3812,13 +3815,17 @@ namespace CGAL { } /** Create an edge given 2 Attribute_handle<0>. + * Note that this function can be used only if 0-attributes are non void * @param h0 the first vertex handle. * @param h1 the second vertex handle. - * Note that this function can be used only if 0-attributes are non void + * if closed==true, the edge has no 2-free dart. + * (note that for CMap there is no differente between true and false, but + * this is not the case for GMap) * @return the dart of the new edge incident to h0. */ Dart_handle make_segment(typename Attribute_handle<0>::type h0, - typename Attribute_handle<0>::type h1) + typename Attribute_handle<0>::type h1, + bool /*closed*/=false) { Dart_handle d1 = this->make_edge(); diff --git a/Generalized_map/include/CGAL/Generalized_map.h b/Generalized_map/include/CGAL/Generalized_map.h index 908bc1ecc41..51516bc5a59 100644 --- a/Generalized_map/include/CGAL/Generalized_map.h +++ b/Generalized_map/include/CGAL/Generalized_map.h @@ -2950,30 +2950,47 @@ namespace CGAL { } /** Create an edge. + * if closed==true, the edge has no 2-free dart. * @return a dart of the new edge. */ - Dart_handle make_edge() + Dart_handle make_edge(bool closed=false) { - Dart_handle d1 = create_dart(); - Dart_handle d2 = create_dart(); + Dart_handle d1=create_dart(); + Dart_handle d2=create_dart(); basic_link_alpha<0>(d1, d2); + if (closed) + { + Dart_handle d3=create_dart(); + Dart_handle d4=create_dart(); + basic_link_alpha<0>(d3, d4); + basic_link_alpha<2>(d1, d3); + basic_link_alpha<2>(d2, d4); + } + return d1; } /** Create an edge given 2 Attribute_handle<0>. + * Note that this function can be used only if 0-attributes are non void * @param h0 the first vertex handle. * @param h1 the second vertex handle. - * Note that this function can be used only if 0-attributes are non void + * if closed==true, the edge has no 2-free dart. * @return the dart of the new edge incident to h0. */ Dart_handle make_segment(typename Attribute_handle<0>::type h0, - typename Attribute_handle<0>::type h1) + typename Attribute_handle<0>::type h1, + bool closed=false) { - Dart_handle d1 = this->make_edge(); + Dart_handle d1 = this->make_edge(closed); set_dart_attribute<0>(d1,h0); set_dart_attribute<0>(this->alpha<0>(d1),h1); - + if (closed) + { + set_dart_attribute<0>(this->alpha<2>(d1),h0); + set_dart_attribute<0>(this->alpha<0,2>(d1),h1); + } + return d1; } diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h index 83f17fd274b..17b2e5657a1 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h @@ -496,12 +496,15 @@ namespace CGAL { /** Create a segment given 2 points. * @param p0 the first point. * @param p1 the second point. + * if closed==true, the edge has no 2-free dart. * @return the dart of the new segment incident to p0. */ - Dart_handle make_segment(const Point& p0,const Point& p1) + Dart_handle make_segment(const Point& p0,const Point& p1, + bool closed=false) { return make_segment(create_vertex_attribute(p0), - create_vertex_attribute(p1)); + create_vertex_attribute(p1), + closed); } /** Create a triangle given 3 points. diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h index f035f1b6be9..30929d66edc 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h @@ -101,12 +101,10 @@ namespace CGAL { CGAL_assertion(v1 < initVertices.size()); CGAL_assertion(v2 < initVertices.size()); - d1 = alcc.create_dart(initVertices[v1]); - d2 = alcc.create_dart(initVertices[v2]); - alcc.template link_beta<2>(d1, d2); + d1 = alcc.make_segment(initVertices[v1], initVertices[v2], true); testVertices[v1].push_back(d1); - testVertices[v2].push_back(d2); + testVertices[v2].push_back(alcc.template opposite<2>(d1)); } // LCC associating directions and darts.