1 // Copyright (c) 2006 Foundation for Research and Technology-Hellas (Greece).
2 // All rights reserved.
3 //
4 // This file is part of CGAL (www.cgal.org).
5 //
6 // $URL: https://github.com/CGAL/cgal/blob/v5.3/Voronoi_diagram_2/include/CGAL/Voronoi_diagram_2/Construct_dual_points.h $
7 // $Id: Construct_dual_points.h 942d461 2021-05-05T16:59:22+02:00 Mael Rouxel-Labbé
8 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
9 //
10 //
11 // Author(s)     : Menelaos Karavelas <mkaravel@iacm.forth.gr>
12 
13 #ifndef CGAL_VORONOI_DIAGRAM_2_CONSTRUCT_DUAL_POINTS_H
14 #define CGAL_VORONOI_DIAGRAM_2_CONSTRUCT_DUAL_POINTS_H 1
15 
16 #include <CGAL/license/Voronoi_diagram_2.h>
17 
18 
19 #include <CGAL/Voronoi_diagram_2/basic.h>
20 
21 namespace CGAL {
22 
23 namespace VoronoiDiagram_2 { namespace Internal {
24 
25 //=========================================================================
26 
27 template<class AG2>
28 class Apollonius_graph_Voronoi_point_2
29 {
30 private:
31   typedef typename AG2::Geom_traits      Geom_traits;
32 
33 public:
34   typedef typename Geom_traits::Point_2  result_type;
35   typedef typename AG2::Face_handle      Face_handle;
36 
operator()37   result_type operator()(const Face_handle& f) const {
38     return Geom_traits().construct_Apollonius_vertex_2_object()
39       (f->vertex(0)->site(), f->vertex(1)->site(), f->vertex(2)->site());
40   }
41 };
42 
43 //=========================================================================
44 
45 template<class DT2>
46 class Delaunay_triangulation_Voronoi_point_2
47 {
48 private:
49   typedef typename DT2::Geom_traits       Geom_traits;
50 
51 public:
52   typedef typename Geom_traits::Point_2   result_type;
53   typedef typename DT2::Face_handle       Face_handle;
54 
operator()55   result_type operator()(const Face_handle& f) const {
56     return Geom_traits().construct_circumcenter_2_object()
57       (f->vertex(0)->point(), f->vertex(1)->point(), f->vertex(2)->point());
58   }
59 };
60 
61 //=========================================================================
62 
63 template<class RT2>
64 class Regular_triangulation_Voronoi_point_2
65 {
66 private:
67   typedef typename RT2::Geom_traits       Geom_traits;
68 public:
69   typedef typename Geom_traits::Point_2   result_type;
70   typedef typename RT2::Face_handle       Face_handle;
71 
operator()72   result_type operator()(const Face_handle& f) const {
73     return Geom_traits().construct_weighted_circumcenter_2_object()
74       (f->vertex(0)->point(), f->vertex(1)->point(), f->vertex(2)->point());
75   }
76 };
77 
78 //=========================================================================
79 
80 template<class DToS2>
81 struct DToS2_Voronoi_point_2
82 {
83 private:
84   typedef typename DToS2::Geom_traits                      Geom_traits;
85   typedef typename Geom_traits::Point_on_sphere_2          Point_on_sphere_2;
86 
87 public:
88   typedef typename DToS2::Face_handle                      Face_handle;
89   typedef Point_on_sphere_2                                result_type;
90 
DToS2_Voronoi_point_2DToS2_Voronoi_point_291   DToS2_Voronoi_point_2(const Geom_traits& gt) : gt(gt) { }
92 
operatorDToS2_Voronoi_point_293   result_type operator()(const Face_handle f) const
94   {
95     return gt.construct_circumcenter_on_sphere_2_object()(
96              f->vertex(0)->point(), f->vertex(1)->point(), f->vertex(2)->point());
97   }
98 
99 private:
100   const Geom_traits& gt;
101 };
102 
103 //=========================================================================
104 
105 template<class SVD2>
106 class Segment_Voronoi_diagram_Voronoi_point_2
107 {
108 private:
109   typedef typename SVD2::Geom_traits   Geom_traits;
110 
111 public:
112   typedef typename SVD2::Point_2       result_type;
113   typedef typename SVD2::Face_handle   Face_handle;
114 
operator()115   result_type operator()(const Face_handle& f) const {
116     return Geom_traits().construct_svd_vertex_2_object()
117       (f->vertex(0)->site(), f->vertex(1)->site(), f->vertex(2)->site());
118   }
119 };
120 
121 template<class SDG2>
122 class Segment_Delaunay_graph_Voronoi_point_2
123 {
124 private:
125   typedef typename SDG2::Geom_traits   Geom_traits;
126 
127 public:
128   typedef typename SDG2::Point_2       result_type;
129   typedef typename SDG2::Face_handle   Face_handle;
130 
operator()131   result_type operator()(const Face_handle& f) const {
132     return Geom_traits().construct_svd_vertex_2_object()
133       (f->vertex(0)->site(), f->vertex(1)->site(), f->vertex(2)->site());
134   }
135 };
136 
137 //=========================================================================
138 
139 } } //namespace VoronoiDiagram_2::Internal
140 
141 } //namespace CGAL
142 
143 #endif // CGAL_VORONOI_DIAGRAM_2_CONSTRUCT_DUAL_POINTS_H
144