make it work for the triangulation hierarchy with regular

This commit is contained in:
Andreas Fabri 2017-03-03 16:25:09 +01:00 committed by Mael Rouxel-Labbé
parent d73be575f5
commit 83b0d24df8
2 changed files with 53 additions and 9 deletions

View File

@ -382,9 +382,10 @@ public:
} }
Face_handle 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, Line_face_circulator line_walk(const Bare_point& p,

View File

@ -52,7 +52,7 @@ class Triangulation_hierarchy_2
public: public:
typedef Tr_ Tr_Base; typedef Tr_ Tr_Base;
typedef typename Tr_Base::Geom_traits Geom_traits; 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::size_type size_type;
typedef typename Tr_Base::Vertex_handle Vertex_handle; typedef typename Tr_Base::Vertex_handle Vertex_handle;
typedef typename Tr_Base::Face_handle Face_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_vertices_iterator Finite_vertices_iterator;
//typedef typename Tr_Base::Finite_faces_iterator Finite_faces_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; typedef typename Tr_Base::Weighted_tag Weighted_tag;
#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2 #ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
@ -177,15 +181,27 @@ public:
//LOCATE //LOCATE
Face_handle Face_handle
locate(const Point& p, locate(const Bare_point& p,
Locate_type& lt, Locate_type& lt,
int& li, int& li,
Face_handle start = Face_handle()) const; Face_handle start = Face_handle()) const;
Face_handle Face_handle
locate(const Point &p, locate(const Weighted_point& p,
Locate_type& lt,
int& li,
Face_handle start = Face_handle()) const; 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 Vertex_handle
nearest_vertex(const Point& p, Face_handle start = Face_handle()) const nearest_vertex(const Point& p, Face_handle start = Face_handle()) const
{ {
@ -210,12 +226,23 @@ private:
return Vertex_handle(); return Vertex_handle();
} }
void locate_in_all(const Point& p, void locate_in_all(const Bare_point& p,
Locate_type& lt, Locate_type& lt,
int& li, int& li,
Face_handle loc, Face_handle loc,
Face_handle Face_handle
pos[Triangulation_hierarchy_2__maxlevel]) const; 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(); int random_level();
// helping function to copy_triangulation // helping function to copy_triangulation
@ -655,7 +682,7 @@ insert_and_give_new_faces(const Point &p,
template <class Tr> template <class Tr>
typename Triangulation_hierarchy_2<Tr>::Face_handle typename Triangulation_hierarchy_2<Tr>::Face_handle
Triangulation_hierarchy_2<Tr>:: Triangulation_hierarchy_2<Tr>::
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]; Face_handle positions[Triangulation_hierarchy_2__maxlevel];
locate_in_all(p,lt,li,loc,positions); 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 <class Tr> template <class Tr>
typename Triangulation_hierarchy_2<Tr>::Face_handle typename Triangulation_hierarchy_2<Tr>::Face_handle
Triangulation_hierarchy_2<Tr>:: Triangulation_hierarchy_2<Tr>::
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 <class Tr>
typename Triangulation_hierarchy_2<Tr>::Face_handle
Triangulation_hierarchy_2<Tr>::
locate(const Bare_point& p, Face_handle loc ) const
{ {
Locate_type lt; Locate_type lt;
int li; int li;
return locate(p, lt, li, loc); return locate(p, lt, li, loc);
} }
template <class Tr>
typename Triangulation_hierarchy_2<Tr>::Face_handle
Triangulation_hierarchy_2<Tr>::
locate(const Weighted_point& p, Face_handle loc ) const
{
return locate(geom_traits().construct_point_2_object()(p), loc);
}
template <class Tr> template <class Tr>
void void
Triangulation_hierarchy_2<Tr>:: Triangulation_hierarchy_2<Tr>::
locate_in_all(const Point& p, locate_in_all(const Bare_point& p,
Locate_type& lt, Locate_type& lt,
int& li, int& li,
Face_handle loc, Face_handle loc,