EMODnet Quantized Mesh Generator for Cesium
Projection_traits_3_extended.h
1 // Copyright (c) 2018 Coronis Computing S.L. (Spain)
2 // All rights reserved.
3 //
4 // This file is part of EMODnet Quantized Mesh Generator for Cesium.
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <https://www.gnu.org/licenses/>.
18 //
19 // Author: Ricard Campos (ricardcd@gmail.com)
20 
21 #ifndef EMODNET_QMGC_PROJECTION_TRAITS_3_EXTENDED_H
22 #define EMODNET_QMGC_PROJECTION_TRAITS_3_EXTENDED_H
23 
24 #include <CGAL/internal/Projection_traits_3.h>
25 
26 
27 namespace CGAL {
28 
29 namespace internal {
30 
37  template <class R,int dim>
38  class Squared_distance_projected_3_extended : public Squared_distance_projected_3<R,dim>
39  {
40  public:
41  typedef typename R::Point_3 Point_3;
42  typedef typename R::Point_2 Point_2;
43  typedef typename R::Line_3 Line_3;
44  typedef typename R::Line_2 Line_2;
45  typedef typename R::Segment_2 Segment_2;
46  typedef typename R::Segment_3 Segment_3;
47  typedef typename R::FT RT;
48 
49  RT operator()(const Segment_3& s, const Point_3& p) const
50  {
51  Point_2 p2(this->project(p));
52  Segment_2 s2(this->project(s.point(0)), this->project(s.point(1)));
53  return squared_distance(p2, s2);
54  }
55 
56  RT operator()(const Point_3& p, const Point_3& q) const
57  {
58  this->operator()(p,q);
59  }
60 
61  RT operator()(const Line_3& l, const Point_3& p) const
62  {
63  this->operator()(l,p);
64  }
65  };
66 
67 
68  template<class R, int dim>
69  class Projection_traits_3_extended : public Projection_traits_3<R, dim>
70  {
71  public:
72  // We replicate all the typedefs, as they are not inherited necessarily
73  typedef Projection_traits_3<R,dim> Traits;
74  typedef R Rp;
75  typedef typename R::FT FT;
76  typedef typename Rp::Point_3 Point_2;
77  typedef typename Rp::Segment_3 Segment_2;
78  typedef typename Rp::Vector_3 Vector_2;
79  typedef typename Rp::Triangle_3 Triangle_2;
80  typedef typename Rp::Line_3 Line_2;
81  typedef typename Rp::Ray_3 Ray_2;
82  typedef typename Projector<R,dim>::Less_x_2 Less_x_2;
83  typedef typename Projector<R,dim>::Less_y_2 Less_y_2;
84  typedef typename Projector<R,dim>::Compare_x_2 Compare_x_2;
85  typedef typename Projector<R,dim>::Compare_y_2 Compare_y_2;
86  typedef Orientation_projected_3<Rp,dim> Orientation_2;
87  typedef Angle_projected_3<Rp,dim> Angle_2;
88  typedef Side_of_oriented_circle_projected_3<Rp,dim> Side_of_oriented_circle_2;
89  typedef Less_signed_distance_to_line_projected_3<Rp,dim> Less_signed_distance_to_line_2;
90  typedef Side_of_bounded_circle_projected_3<Rp,dim> Side_of_bounded_circle_2;
91  typedef Compare_distance_projected_3<Rp,dim> Compare_distance_2;
92  typedef Collinear_are_ordered_along_line_projected_3<Rp,dim> Collinear_are_ordered_along_line_2;
93  typedef Intersect_projected_3<Rp,dim> Intersect_2;
94  typedef Compute_squared_radius_projected<Rp,dim> Compute_squared_radius_2;
95  typedef Compute_scalar_product_projected_3<Rp,dim> Compute_scalar_product_2;
96  typedef Compute_squared_length_projected_3<Rp,dim> Compute_squared_length_2;
97  typedef typename Rp::Construct_segment_3 Construct_segment_2;
98  typedef typename Rp::Construct_translated_point_3 Construct_translated_point_2;
99  typedef typename Rp::Construct_midpoint_3 Construct_midpoint_2;
100  typedef typename Rp::Construct_vector_3 Construct_vector_2;
101  typedef typename Rp::Construct_scaled_vector_3 Construct_scaled_vector_2;
102  typedef typename Rp::Construct_triangle_3 Construct_triangle_2;
103  typedef typename Rp::Construct_line_3 Construct_line_2;
104  typedef typename Projector<R,dim>::Equal_x_2 Equal_x_2;
105  typedef typename Projector<R,dim>::Equal_y_2 Equal_y_2;
106  typedef Circumcenter_center_projected<Rp,dim> Construct_circumcenter_2;
107  typedef Compute_area_projected<Rp,dim> Compute_area_2;
108  typedef Point_2 Point;
109  typedef Segment_2 Segment;
110  typedef Triangle_2 Triangle;
111 
112  // Add also the 3D versions of this stuff (needed in PointSetFeaturesSimplificationCost class)
113  typedef typename R::Point_3 Point_3;
114  typedef typename R::Segment_3 Segment_3;
115  typedef typename R::Vector_3 Vector_3;
116  typedef typename R::Plane_3 Plane_3;
117  typedef typename Rp::Construct_segment_3 Construct_segment_3;
118  typedef typename Rp::Compute_squared_distance_3 Compute_squared_distance_3;
119 
120  // The important changes:
122 
123  Compute_squared_distance_2
124  compute_squared_distance_2_object () const
125  {
126  return Compute_squared_distance_2();
127  }
128 
129  Compute_squared_distance_3
130  compute_squared_distance_3_object () const
131  {
132  return Compute_squared_distance_3();
133  }
134 
135  Construct_segment_3
136  construct_segment_3_object () const
137  {
138  return Construct_segment_3();
139  }
140  };
141 
142 } // End namespace internal
143 
144 template < class R >
147 {};
148 
149 template < class R >
152 {};
153 
154 template < class R >
157 {};
158 
159 } // End namespace CGAL
160 
161 #endif //EMODNET_QMGC_PROJECTION_TRAITS_3_EXTENDED_H
Definition: Projection_traits_3_extended.h:150
Extension of CGAL&#39;s Constrained_placement class.
Definition: further_constrained_placement.h:38
Class extending the functionality of CGAL::internal::Squared_distance_projected_3 We had to modify th...
Definition: Projection_traits_3_extended.h:38
Definition: Projection_traits_3_extended.h:155
Definition: Projection_traits_3_extended.h:69
Definition: Projection_traits_3_extended.h:145