mirror of https://github.com/CGAL/cgal
Add VD2's removal policy for ToS2 (+ caching)
This commit is contained in:
parent
3dce682668
commit
d5a306b817
|
|
@ -0,0 +1,65 @@
|
||||||
|
// Copyright (c) 2021 GeometryFactory
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of CGAL (www.cgal.org).
|
||||||
|
//
|
||||||
|
// $URL$
|
||||||
|
// $Id$
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Author(s) : Menelaos Karavelas <mkaravel@iacm.forth.gr>
|
||||||
|
// Mael Rouxel-Labbé
|
||||||
|
|
||||||
|
#ifndef CGAL_DELAUNAY_TRIANGULATION_ON_SPHERE_ADAPTATION_POLICIES_2_H
|
||||||
|
#define CGAL_DELAUNAY_TRIANGULATION_ON_SPHERE_ADAPTATION_POLICIES_2_H 1
|
||||||
|
|
||||||
|
#include <CGAL/license/Voronoi_diagram_2.h>
|
||||||
|
|
||||||
|
#include <CGAL/Voronoi_diagram_2/basic.h>
|
||||||
|
#include <CGAL/Voronoi_diagram_2/Delaunay_triangulation_on_sphere_degeneracy_testers.h>
|
||||||
|
#include <CGAL/Voronoi_diagram_2/Policy_base.h>
|
||||||
|
#include <CGAL/Voronoi_diagram_2/Default_site_inserters.h>
|
||||||
|
#include <CGAL/Voronoi_diagram_2/Identity_rejectors.h>
|
||||||
|
|
||||||
|
#include <CGAL/Identity_policy_2.h>
|
||||||
|
|
||||||
|
namespace CGAL {
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
//=========================================================================
|
||||||
|
|
||||||
|
template<class DToS2>
|
||||||
|
struct Delaunay_triangulation_on_sphere_degeneracy_removal_policy_2
|
||||||
|
: public CGAL_VORONOI_DIAGRAM_2_INS::Policy_base
|
||||||
|
<DToS2,
|
||||||
|
CGAL_VORONOI_DIAGRAM_2_INS::Delaunay_triangulation_on_sphere_edge_tester_2<DToS2>,
|
||||||
|
CGAL_VORONOI_DIAGRAM_2_INS::Identity_face_rejector<DToS2>,
|
||||||
|
CGAL_VORONOI_DIAGRAM_2_INS::Default_site_inserter<typename DToS2::Point,DToS2>,
|
||||||
|
CGAL_VORONOI_DIAGRAM_2_INS::Default_site_remover<DToS2> >
|
||||||
|
{
|
||||||
|
typedef typename DToS2::Point Site_2;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
//=========================================================================
|
||||||
|
|
||||||
|
template<class DToS2>
|
||||||
|
struct Delaunay_triangulation_on_sphere_caching_degeneracy_removal_policy_2
|
||||||
|
: public CGAL_VORONOI_DIAGRAM_2_INS::Caching_policy_base
|
||||||
|
<DToS2,
|
||||||
|
CGAL_VORONOI_DIAGRAM_2_INS::Delaunay_triangulation_on_sphere_edge_tester_2<DToS2>,
|
||||||
|
CGAL_VORONOI_DIAGRAM_2_INS::Identity_face_rejector<DToS2>,
|
||||||
|
CGAL_VORONOI_DIAGRAM_2_INS::Default_site_inserter<typename DToS2::Point,DToS2>,
|
||||||
|
CGAL_VORONOI_DIAGRAM_2_INS::Default_site_remover<DToS2> >
|
||||||
|
{
|
||||||
|
typedef typename DToS2::Point Site_2;
|
||||||
|
};
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
//=========================================================================
|
||||||
|
|
||||||
|
} // namespace CGAL
|
||||||
|
|
||||||
|
#endif // CGAL_DELAUNAY_TRIANGULATION_ON_SPHERE_ADAPTATION_POLICIES_2_H
|
||||||
|
|
@ -52,9 +52,6 @@ public:
|
||||||
typedef typename Edge_rejector::Delaunay_graph Delaunay_graph;
|
typedef typename Edge_rejector::Delaunay_graph Delaunay_graph;
|
||||||
typedef typename Edge_rejector::Edge Edge;
|
typedef typename Edge_rejector::Edge Edge;
|
||||||
typedef typename Edge_rejector::Face_handle Face_handle;
|
typedef typename Edge_rejector::Face_handle Face_handle;
|
||||||
typedef typename Edge_rejector::Edge_circulator Edge_circulator;
|
|
||||||
typedef typename Edge_rejector::All_edges_iterator All_edges_iterator;
|
|
||||||
typedef typename Edge_rejector::Finite_edges_iterator Finite_edges_iterator;
|
|
||||||
typedef typename Edge_rejector::result_type result_type;
|
typedef typename Edge_rejector::result_type result_type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -99,18 +96,9 @@ public:
|
||||||
return operator()(dual, Edge(f,i));
|
return operator()(dual, Edge(f,i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename EdgeIterator>
|
||||||
bool operator()(const Delaunay_graph& dual,
|
bool operator()(const Delaunay_graph& dual,
|
||||||
const Edge_circulator& ec) const {
|
const EdgeIterator eit) const {
|
||||||
return operator()(dual, *ec);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator()(const Delaunay_graph& dual,
|
|
||||||
const All_edges_iterator& eit) const {
|
|
||||||
return operator()(dual, *eit);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator()(const Delaunay_graph& dual,
|
|
||||||
const Finite_edges_iterator& eit) const {
|
|
||||||
return operator()(dual, *eit);
|
return operator()(dual, *eit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -167,9 +155,6 @@ public:
|
||||||
typedef typename Edge_rejector::Delaunay_graph Delaunay_graph;
|
typedef typename Edge_rejector::Delaunay_graph Delaunay_graph;
|
||||||
typedef typename Edge_rejector::Edge Edge;
|
typedef typename Edge_rejector::Edge Edge;
|
||||||
typedef typename Edge_rejector::Face_handle Face_handle;
|
typedef typename Edge_rejector::Face_handle Face_handle;
|
||||||
typedef typename Edge_rejector::Edge_circulator Edge_circulator;
|
|
||||||
typedef typename Edge_rejector::All_edges_iterator All_edges_iterator;
|
|
||||||
typedef typename Edge_rejector::Finite_edges_iterator Finite_edges_iterator;
|
|
||||||
typedef typename Edge_rejector::result_type result_type;
|
typedef typename Edge_rejector::result_type result_type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -214,18 +199,9 @@ public:
|
||||||
return operator()(dual, Edge(f,i));
|
return operator()(dual, Edge(f,i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename EdgeIterator>
|
||||||
bool operator()(const Delaunay_graph& dual,
|
bool operator()(const Delaunay_graph& dual,
|
||||||
const Edge_circulator& ec) const {
|
const EdgeIterator eit) const {
|
||||||
return operator()(dual, *ec);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator()(const Delaunay_graph& dual,
|
|
||||||
const All_edges_iterator& eit) const {
|
|
||||||
return operator()(dual, *eit);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator()(const Delaunay_graph& dual,
|
|
||||||
const Finite_edges_iterator& eit) const {
|
|
||||||
return operator()(dual, *eit);
|
return operator()(dual, *eit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -250,11 +226,11 @@ public:
|
||||||
|
|
||||||
bool is_valid() const { return true; }
|
bool is_valid() const { return true; }
|
||||||
|
|
||||||
bool is_valid(const Delaunay_graph& dual) const {
|
bool is_valid(const Delaunay_graph& dual) const
|
||||||
|
{
|
||||||
bool valid = true;
|
bool valid = true;
|
||||||
All_edges_iterator eit;
|
for (auto eit = dual.all_edges_begin(); eit != dual.all_edges_end(); ++eit) {
|
||||||
for (eit = dual.all_edges_begin(); eit != dual.all_edges_end(); ++eit) {
|
const Edge& e = *eit;
|
||||||
Edge e = *eit;
|
|
||||||
bool b = !emap.is_defined(e) || (emap[e] != UNDEFINED);
|
bool b = !emap.is_defined(e) || (emap[e] != UNDEFINED);
|
||||||
valid = valid && b;
|
valid = valid && b;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
// Copyright (c) 2021 GeometryFactory.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of CGAL (www.cgal.org).
|
||||||
|
//
|
||||||
|
// $URL$
|
||||||
|
// $Id$
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Author(s) : Menelaos Karavelas <mkaravel@iacm.forth.gr>
|
||||||
|
// Mael Rouxel-Labbé
|
||||||
|
|
||||||
|
#ifndef CGAL_VORONOI_DIAGRAM_2_DELAUNAY_TRIANGULATION_ON_SPHERE_DEGENERACY_TESTERS_H
|
||||||
|
#define CGAL_VORONOI_DIAGRAM_2_DELAUNAY_TRIANGULATION_ON_SPHERE_DEGENERACY_TESTERS_H 1
|
||||||
|
|
||||||
|
#include <CGAL/license/Voronoi_diagram_2.h>
|
||||||
|
|
||||||
|
#include <CGAL/Voronoi_diagram_2/basic.h>
|
||||||
|
#include <CGAL/Voronoi_diagram_2/Adaptation_traits_base_2.h>
|
||||||
|
#include <CGAL/Voronoi_diagram_2/Identity_rejectors.h>
|
||||||
|
|
||||||
|
namespace CGAL {
|
||||||
|
namespace VoronoiDiagram_2 {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
//=========================================================================
|
||||||
|
|
||||||
|
// tests whether a dual edge has zero length
|
||||||
|
template <class DG>
|
||||||
|
class Delaunay_triangulation_on_sphere_edge_tester_2
|
||||||
|
: public CGAL_VORONOI_DIAGRAM_2_INS::Rejector_base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef DG Delaunay_graph;
|
||||||
|
|
||||||
|
typedef typename Delaunay_graph::Edge Edge;
|
||||||
|
typedef typename Delaunay_graph::Face_handle Face_handle;
|
||||||
|
|
||||||
|
typedef bool result_type;
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef typename Delaunay_graph::Geom_traits Geom_traits;
|
||||||
|
typedef typename Delaunay_graph::Vertex_handle Vertex_handle;
|
||||||
|
typedef typename Delaunay_graph::Point Point;
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool operator()(const Delaunay_graph& dual,
|
||||||
|
const Face_handle f, int i) const
|
||||||
|
{
|
||||||
|
if(dual.dimension() == 1)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const Vertex_handle v3 = f->vertex(i);
|
||||||
|
const Vertex_handle v4 = dual.tds().mirror_vertex(f, i);
|
||||||
|
|
||||||
|
const Vertex_handle v1 = f->vertex(dual.ccw(i));
|
||||||
|
const Vertex_handle v2 = f->vertex(dual.cw(i));
|
||||||
|
|
||||||
|
const Point& p1 = v1->point();
|
||||||
|
const Point& p2 = v2->point();
|
||||||
|
const Point& p3 = v3->point();
|
||||||
|
const Point& p4 = v4->point();
|
||||||
|
const Oriented_side os = dual.geom_traits().side_of_oriented_circle_on_sphere_2_object()(p1,p2,p3,p4);
|
||||||
|
|
||||||
|
return (os == ON_ORIENTED_BOUNDARY);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator()(const Delaunay_graph& dual, const Edge& e) const
|
||||||
|
{
|
||||||
|
return operator()(dual, e.first, e.second);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename EdgeIterator>
|
||||||
|
bool operator()(const Delaunay_graph& dual,
|
||||||
|
const EdgeIterator eit) const
|
||||||
|
{
|
||||||
|
return operator()(dual, *eit);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
//=========================================================================
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace VoronoiDiagram_2
|
||||||
|
} // namespace CGAL
|
||||||
|
|
||||||
|
#endif // CGAL_VORONOI_DIAGRAM_2_DELAUNAY_TRIANGULATION_ON_SPHERE_DEGENERACY_TESTERS_H
|
||||||
Loading…
Reference in New Issue