mirror of https://github.com/CGAL/cgal
pointers for insert point on segment functions
Introduce pointers for functions that insert a point on a segment. For L2, to keep the same functionality as before, the pointers point to insert_exact_point_on_segment and insert_point_on_segment functions. Classes derived from Segment_Delaunay_graph_2 can change the pointers to point to more specialized functions. For example, the Linf implementation will point to different specialized function defined in the Linf class.
This commit is contained in:
parent
13db2022ce
commit
8cf9a96b45
|
|
@ -309,12 +309,35 @@ protected:
|
||||||
CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::Internal::Which_list<Edge,List_tag>::List
|
CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::Internal::Which_list<Edge,List_tag>::List
|
||||||
List;
|
List;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// types for insert on segment functions
|
||||||
|
typedef Vertex_triple (Self::*Insert_on_Type)(
|
||||||
|
const Storage_site_2& ss, const Site_2& t,
|
||||||
|
Vertex_handle v, const Tag_true&);
|
||||||
|
Insert_on_Type insert_point_on_segment_ptr;
|
||||||
|
|
||||||
|
typedef Vertex_triple (Self::*Insert_Exact_on_Type)(
|
||||||
|
const Storage_site_2& ss, const Site_2& t,
|
||||||
|
Vertex_handle v);
|
||||||
|
Insert_Exact_on_Type insert_exact_point_on_segment_ptr;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// CREATION helper
|
||||||
|
void setup_insert_on_pointers_l2(void) {
|
||||||
|
insert_point_on_segment_ptr = &Self::insert_point_on_segment;
|
||||||
|
insert_exact_point_on_segment_ptr = &Self::insert_exact_point_on_segment;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// CREATION
|
// CREATION
|
||||||
//---------
|
//---------
|
||||||
Segment_Delaunay_graph_2(const Geom_traits& gt = Geom_traits(),
|
Segment_Delaunay_graph_2(const Geom_traits& gt = Geom_traits(),
|
||||||
const Storage_traits& st = Storage_traits())
|
const Storage_traits& st = Storage_traits())
|
||||||
: DG(gt), st_(st) {}
|
: DG(gt), st_(st)
|
||||||
|
{
|
||||||
|
setup_insert_on_pointers_l2();
|
||||||
|
}
|
||||||
|
|
||||||
template< class Input_iterator >
|
template< class Input_iterator >
|
||||||
Segment_Delaunay_graph_2(Input_iterator first, Input_iterator beyond,
|
Segment_Delaunay_graph_2(Input_iterator first, Input_iterator beyond,
|
||||||
|
|
@ -322,6 +345,7 @@ public:
|
||||||
const Storage_traits& st = Storage_traits())
|
const Storage_traits& st = Storage_traits())
|
||||||
: DG(gt), st_(st)
|
: DG(gt), st_(st)
|
||||||
{
|
{
|
||||||
|
setup_insert_on_pointers_l2();
|
||||||
insert(first, beyond);
|
insert(first, beyond);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1061,11 +1085,11 @@ protected:
|
||||||
Vertex_handle insert_point2(const Storage_site_2& ss,
|
Vertex_handle insert_point2(const Storage_site_2& ss,
|
||||||
const Site_2& t, Vertex_handle vnear);
|
const Site_2& t, Vertex_handle vnear);
|
||||||
|
|
||||||
Triple<Vertex_handle,Vertex_handle,Vertex_handle>
|
Vertex_triple
|
||||||
insert_point_on_segment(const Storage_site_2& ss, const Site_2& t,
|
insert_point_on_segment(const Storage_site_2& ss, const Site_2& t,
|
||||||
Vertex_handle v, const Tag_true&);
|
Vertex_handle v, const Tag_true&);
|
||||||
|
|
||||||
Triple<Vertex_handle,Vertex_handle,Vertex_handle>
|
Vertex_triple
|
||||||
insert_exact_point_on_segment(const Storage_site_2& ss, const Site_2& t,
|
insert_exact_point_on_segment(const Storage_site_2& ss, const Site_2& t,
|
||||||
Vertex_handle v);
|
Vertex_handle v);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,8 @@ insert_point(const Storage_site_2& ss, const Site_2& t,
|
||||||
if ( at_res == AT2::INTERIOR ) {
|
if ( at_res == AT2::INTERIOR ) {
|
||||||
CGAL_assertion( t.is_input() );
|
CGAL_assertion( t.is_input() );
|
||||||
|
|
||||||
Vertex_triple vt = insert_exact_point_on_segment(ss, t, vnearest);
|
Vertex_triple vt = (this->*insert_exact_point_on_segment_ptr)(
|
||||||
|
ss, t, vnearest);
|
||||||
return vt.first;
|
return vt.first;
|
||||||
} else {
|
} else {
|
||||||
// the point to be inserted does not belong to the interior of a
|
// the point to be inserted does not belong to the interior of a
|
||||||
|
|
@ -931,7 +932,7 @@ insert_intersecting_segment_with_tag(const Storage_site_2& ss,
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vertex_triple vt = insert_point_on_segment(ss, t, v, tag);
|
Vertex_triple vt = (this->*insert_point_on_segment_ptr)(ss, t, v, tag);
|
||||||
|
|
||||||
Vertex_handle vsx = vt.first;
|
Vertex_handle vsx = vt.first;
|
||||||
|
|
||||||
|
|
@ -2778,6 +2779,11 @@ void
|
||||||
Segment_Delaunay_graph_2<Gt,ST,D_S,LTag>::
|
Segment_Delaunay_graph_2<Gt,ST,D_S,LTag>::
|
||||||
copy(Segment_Delaunay_graph_2& other)
|
copy(Segment_Delaunay_graph_2& other)
|
||||||
{
|
{
|
||||||
|
// copy the insert_on method pointers
|
||||||
|
insert_point_on_segment_ptr = other.insert_point_on_segment_ptr;
|
||||||
|
insert_exact_point_on_segment_ptr =
|
||||||
|
other.insert_exact_point_on_segment_ptr;
|
||||||
|
|
||||||
// first copy the point container
|
// first copy the point container
|
||||||
pc_ = other.pc_;
|
pc_ = other.pc_;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue