diff --git a/Voronoi_diagram_2/include/CGAL/Delaunay_triangulation_on_sphere_adaptation_traits_2.h b/Voronoi_diagram_2/include/CGAL/Delaunay_triangulation_on_sphere_adaptation_traits_2.h new file mode 100644 index 00000000000..a2733336e5b --- /dev/null +++ b/Voronoi_diagram_2/include/CGAL/Delaunay_triangulation_on_sphere_adaptation_traits_2.h @@ -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 + +#include +#include +#include +#include + +namespace CGAL { + +template +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 Access_site_2; + typedef CGAL_VORONOI_DIAGRAM_2_INS::DToS2_Voronoi_point_2 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 diff --git a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Construct_dual_points.h b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Construct_dual_points.h index 993dacbeae9..af54b688b8d 100644 --- a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Construct_dual_points.h +++ b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Construct_dual_points.h @@ -77,6 +77,31 @@ public: //========================================================================= +template +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 Segment_Voronoi_diagram_Voronoi_point_2 { diff --git a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Site_accessors.h b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Site_accessors.h index 50f7a347f56..e1d45d99a15 100644 --- a/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Site_accessors.h +++ b/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Site_accessors.h @@ -15,12 +15,11 @@ #include - #include namespace CGAL { - -namespace VoronoiDiagram_2 { namespace Internal { +namespace VoronoiDiagram_2 { +namespace Internal { //========================================================================= //========================================================================= @@ -71,10 +70,32 @@ struct Point_accessor }; //========================================================================= + +template +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