From 83b0d24df8e71f96c345e94086f3600f88ab6fdc Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 3 Mar 2017 16:25:09 +0100 Subject: [PATCH] make it work for the triangulation hierarchy with regular --- .../include/CGAL/Regular_triangulation_2.h | 5 +- .../include/CGAL/Triangulation_hierarchy_2.h | 57 ++++++++++++++++--- 2 files changed, 53 insertions(+), 9 deletions(-) diff --git a/Triangulation_2/include/CGAL/Regular_triangulation_2.h b/Triangulation_2/include/CGAL/Regular_triangulation_2.h index 8d312a24043..928a181b70b 100644 --- a/Triangulation_2/include/CGAL/Regular_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Regular_triangulation_2.h @@ -382,9 +382,10 @@ public: } Face_handle - locate(const Bare_point& bp) + locate(const Bare_point& bp, + Face_handle start = Face_handle()) { - return Base::locate(geom_traits().construct_weighted_point_2_object()(bp)); + return Base::locate(geom_traits().construct_weighted_point_2_object()(bp), start); } Line_face_circulator line_walk(const Bare_point& p, diff --git a/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h b/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h index 1735d9c2290..99f7fd9d581 100644 --- a/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h @@ -52,7 +52,7 @@ class Triangulation_hierarchy_2 public: typedef Tr_ Tr_Base; typedef typename Tr_Base::Geom_traits Geom_traits; - typedef typename Tr_Base::Point Point; + typedef typename Tr_Base::Point Point; // this one may be weighted or not typedef typename Tr_Base::size_type size_type; typedef typename Tr_Base::Vertex_handle Vertex_handle; typedef typename Tr_Base::Face_handle Face_handle; @@ -61,6 +61,10 @@ class Triangulation_hierarchy_2 typedef typename Tr_Base::Finite_vertices_iterator Finite_vertices_iterator; //typedef typename Tr_Base::Finite_faces_iterator Finite_faces_iterator; + typedef typename Geom_traits::Point_2 Bare_point; + typedef typename Geom_traits::Weighted_point_2 Weighted_point; + + typedef typename Tr_Base::Weighted_tag Weighted_tag; #ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2 @@ -177,15 +181,27 @@ public: //LOCATE Face_handle - locate(const Point& p, + locate(const Bare_point& p, Locate_type& lt, int& li, Face_handle start = Face_handle()) const; Face_handle - locate(const Point &p, + locate(const Weighted_point& p, + Locate_type& lt, + int& li, Face_handle start = Face_handle()) const; + + Face_handle + locate(const Bare_point &p, + Face_handle start = Face_handle()) const; + + Face_handle + locate(const Weighted_point &p, + Face_handle start = Face_handle()) const; + + Vertex_handle nearest_vertex(const Point& p, Face_handle start = Face_handle()) const { @@ -210,12 +226,23 @@ private: return Vertex_handle(); } - void locate_in_all(const Point& p, + void locate_in_all(const Bare_point& p, Locate_type& lt, int& li, Face_handle loc, Face_handle pos[Triangulation_hierarchy_2__maxlevel]) const; + + void locate_in_all(const Weighted_point& p, + Locate_type& lt, + int& li, + Face_handle loc, + Face_handle + pos[Triangulation_hierarchy_2__maxlevel]) const + { + locate_in_all(this->geom_traits().construct_point_2_object()(p), lt, li, loc,pos); + } + int random_level(); // helping function to copy_triangulation @@ -655,7 +682,7 @@ insert_and_give_new_faces(const Point &p, template typename Triangulation_hierarchy_2::Face_handle Triangulation_hierarchy_2:: -locate(const Point& p, Locate_type& lt, int& li, Face_handle loc) const +locate(const Bare_point& p, Locate_type& lt, int& li, Face_handle loc) const { Face_handle positions[Triangulation_hierarchy_2__maxlevel]; locate_in_all(p,lt,li,loc,positions); @@ -665,17 +692,33 @@ locate(const Point& p, Locate_type& lt, int& li, Face_handle loc) const template typename Triangulation_hierarchy_2::Face_handle Triangulation_hierarchy_2:: -locate(const Point& p, Face_handle loc ) const +locate(const Weighted_point& p, Locate_type& lt, int& li, Face_handle loc) const +{ + return locate(geom_traits().construct_point_2_object()(p), lt, li, loc); +} + +template +typename Triangulation_hierarchy_2::Face_handle +Triangulation_hierarchy_2:: +locate(const Bare_point& p, Face_handle loc ) const { Locate_type lt; int li; return locate(p, lt, li, loc); } +template +typename Triangulation_hierarchy_2::Face_handle +Triangulation_hierarchy_2:: +locate(const Weighted_point& p, Face_handle loc ) const +{ + return locate(geom_traits().construct_point_2_object()(p), loc); +} + template void Triangulation_hierarchy_2:: -locate_in_all(const Point& p, +locate_in_all(const Bare_point& p, Locate_type& lt, int& li, Face_handle loc,