Add adaptation traits for ToS2

This commit is contained in:
Mael Rouxel-Labbé 2021-04-30 15:11:41 +02:00
parent 3816336a02
commit e94127c23c
3 changed files with 114 additions and 6 deletions

View File

@ -0,0 +1,62 @@
// 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) : Mael Rouxel-Labbé
#ifndef CGAL_DELAUNAY_TRIANGULATION_ADAPTATION_TRAITS_2_H
#define CGAL_DELAUNAY_TRIANGULATION_ADAPTATION_TRAITS_2_H 1
#include <CGAL/license/Voronoi_diagram_2.h>
#include <CGAL/Voronoi_diagram_2/basic.h>
#include <CGAL/Voronoi_diagram_2/Adaptation_traits_functors.h>
#include <CGAL/Voronoi_diagram_2/Construct_dual_points.h>
#include <CGAL/Voronoi_diagram_2/Site_accessors.h>
namespace CGAL {
template <typename DTOS>
struct Delaunay_triangulation_on_sphere_adaptation_traits_2
{
public:
typedef DTOS Delaunay_graph;
typedef typename Delaunay_graph::Geom_traits Geom_traits;
typedef CGAL_VORONOI_DIAGRAM_2_INS::DToS2_Point_accessor<DTOS> Access_site_2;
typedef CGAL_VORONOI_DIAGRAM_2_INS::DToS2_Voronoi_point_2<DTOS> Construct_Voronoi_point_2;
typedef typename Delaunay_graph::Vertex_handle Delaunay_vertex_handle;
typedef typename Delaunay_graph::Edge Delaunay_edge;
typedef typename Delaunay_graph::Face_handle Delaunay_face_handle;
typedef CGAL::Tag_false Has_nearest_site_2;
typedef CGAL_VORONOI_DIAGRAM_2_INS::Null_functor Nearest_site_2;
Delaunay_triangulation_on_sphere_adaptation_traits_2(const DTOS& dtos) : dtos(dtos) { }
Access_site_2 access_site_2_object() const
{ return Access_site_2(dtos); }
Construct_Voronoi_point_2 construct_Voronoi_point_2_object() const
{ return Construct_Voronoi_point_2(dtos); }
Nearest_site_2 nearest_site_2_object() const
{ return Nearest_site_2(); }
typedef typename Geom_traits::Point_on_sphere_2 Point_2;
typedef Point_2 Site_2;
private:
const DTOS& dtos;
};
} //namespace CGAL
#endif // CGAL_DELAUNAY_TRIANGULATION_ADAPTATION_TRAITS_2_H

View File

@ -77,6 +77,31 @@ public:
//=========================================================================
template<class DTOS>
struct DToS2_Voronoi_point_2
{
private:
typedef typename DTOS::Geom_traits Geom_traits;
typedef typename Geom_traits::Point_on_sphere_2 Point_on_sphere_2;
public:
typedef Point_on_sphere_2 result_type;
typedef typename DTOS::Face_handle Face_handle;
DToS2_Voronoi_point_2(const DTOS& dtos) : dtos(dtos) { }
result_type operator()(const Face_handle f) const
{
return dtos.geom_traits().construct_circumcenter_on_sphere_2_object()(
dtos.point(f, 0), dtos.point(f, 1), dtos.point(f, 2));
}
private:
const DTOS& dtos;
};
//=========================================================================
template<class SVD2>
class Segment_Voronoi_diagram_Voronoi_point_2
{

View File

@ -15,12 +15,11 @@
#include <CGAL/license/Voronoi_diagram_2.h>
#include <CGAL/Voronoi_diagram_2/basic.h>
namespace CGAL {
namespace VoronoiDiagram_2 { namespace Internal {
namespace VoronoiDiagram_2 {
namespace Internal {
//=========================================================================
//=========================================================================
@ -71,10 +70,32 @@ struct Point_accessor
};
//=========================================================================
template <typename DTOS>
struct DToS2_Point_accessor
{
private:
typedef typename DTOS::Geom_traits::Point_on_sphere_2 Point_on_sphere_2;
public:
typedef const Point_on_sphere_2& result_type;
typedef typename DTOS::Vertex_handle Vertex_handle;
DToS2_Point_accessor(const DTOS& dtos) : dtos(dtos) { }
result_type operator()(const Vertex_handle v) const
{
return dtos.point(v);
}
private:
const DTOS& dtos;
};
//=========================================================================
} } //namespace VoronoiDiagram_2::Internal
} //namespace CGAL
} // namespace Internal
} // namespace VoronoiDiagram_2
} // namespace CGAL
#endif // CGAL_VORONOI_DIAGRAM_2_SITE_ACCESSORS_H