diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_plus_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_plus_2.h index d15a10d74ac..c4a8a708ab3 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_plus_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Constrained_triangulation_plus_2.h @@ -213,7 +213,9 @@ size_type insert(PointIterator first, PointIterator last); /*! -Inserts the constraint segment `ab` in the triangulation. +Inserts the constraint segment `ab` in the triangulation. +If the two points are equal the point is inserted but no constraint, +and `Constrained_id(NULL)`is returned. */ Constraint_id insert_constraint(Point a, Point b); @@ -224,14 +226,20 @@ Inserts the constraint `c`. /*! Inserts a constraint whose endpoints are the vertices -pointed by `va` and `vb` in the triangulation. +pointed by `va` and `vb` in the triangulation. +If the two vertex handles are equal no constraint is inserted, +and `Constrained_id(NULL)`is returned. */ Constraint_id insert_constraint(Vertex_handle va, Vertex_handle vb); /*! -Inserts a polyline defined by the points in the range `[first,last)`. -Returns the constraint id. -The polyline is considered as a polygon if the first and last points are equal or if `close = true`. This allows for example to pass the vertex range of a `Polygon_2`. +Inserts a polyline defined by the points in the range `[first,last)` +and returns the constraint id. +The polyline is considered as a closed curve if the first and last point are equal or if `close == true`. This allows for example to pass the vertex range of a `Polygon_2`. +When enumerating the vertices of a closed polyline constraint with a `Vertices_in_constraint_iterator` the first and last vertex are the same. +In case the range is empty `Constrained_id(NULL)`is returned. +In case all points are equal the point is inserted but no constraint, +and `Constrained_id(NULL)`is returned. \tparam PointIterator must be an `InputIterator` with the value type `Point`. */ template < class PointIterator> diff --git a/Triangulation_2/include/CGAL/Polyline_constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Polyline_constrained_triangulation_2.h index c73e7dcf86f..49b1b7105d3 100644 --- a/Triangulation_2/include/CGAL/Polyline_constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Polyline_constrained_triangulation_2.h @@ -508,7 +508,7 @@ public: private: template < class InputIterator> Constraint_id insert_constraint_seq_impl(InputIterator first, InputIterator last, bool is_polygon) - { + {< Face_handle hint; std::vector vertices; for(;first!= last; first++){ @@ -519,7 +519,7 @@ private: vertices.push_back(vh); } } - if(is_polygon) { + if(is_polygon && (vertices.size()>1) && (vertices.front() != vertices.back())){ vertices.push_back(vertices.front()); }