File: Dimension_utils.h

package info (click to toggle)
cgal 6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 144,912 kB
  • sloc: cpp: 810,858; ansic: 208,477; sh: 493; python: 411; makefile: 286; javascript: 174
file content (174 lines) | stat: -rw-r--r-- 6,052 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
// Copyright (c) 2005,2008  INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL: https://github.com/CGAL/cgal/blob/v6.1/Kernel_23/include/CGAL/Kernel/Dimension_utils.h $
// $Id: include/CGAL/Kernel/Dimension_utils.h b26b07a1242 $
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s)     : Sylvain Pion

#ifndef CGAL_KERNEL_DIMENSION_UTILS_H
#define CGAL_KERNEL_DIMENSION_UTILS_H

#include <CGAL/Kernel_traits.h>
#include <CGAL/Dimension.h>

namespace CGAL {

namespace Access {

// Some tools to find the type of a kernel object given its dimension.
// E.g. : Vector<K, 2>::type  is  K::Vector_2.
//
// Currently undocumented => for CGAL internal use only.

// TODO :
// - What about functors ?
//   At least those with a dimensional-independent interface.
// - Another thing which would be nice would be to make d-dimensional
//   algorithms use the 2d-3d kernel interface with a smaller wrapper.
//   (again, this forces a full kernel, not a sub-set traits, but at least...)
//   Then, based on Dimension<>, it's possible to automatically use it.

template < typename K, typename Dim_tag = typename K::Dimension>  struct Point;
template < typename K, typename Dim_tag = typename K::Dimension>  struct Vector;
template < typename K, typename Dim_tag = typename K::Dimension>  struct Iso_box;
template < typename K, typename Dim_tag = typename K::Dimension>  struct Direction;
template < typename K, typename Dim_tag = typename K::Dimension>  struct Line;
template < typename K, typename Dim_tag = typename K::Dimension>  struct Ray;
template < typename K, typename Dim_tag = typename K::Dimension>  struct Segment;
template < typename K, typename Dim_tag = typename K::Dimension>  struct Triangle;
template < typename K, typename Dim_tag = typename K::Dimension>  struct Hypersphere;
template < typename K, typename Dim_tag = typename K::Dimension>  struct Hyperplane;
template < typename K, typename Dim_tag = typename K::Dimension>  struct Aff_transformation;

// Not-so generalizable stuff : Conic_2, Tetrahedron_3.
template < typename K, typename Dim_tag = typename K::Dimension>  struct Tetrahedron;


template < typename K >
struct Point <K, Dimension_tag<2> > { typedef typename K::Point_2 type; };

template < typename K >
struct Point <K, Dimension_tag<3> > { typedef typename K::Point_3 type; };

template < typename K >
struct Point <K, Dynamic_dimension_tag> { typedef typename K::Point_d type; };


template < typename K >
struct Vector <K, Dimension_tag<2> > { typedef typename K::Vector_2 type; };

template < typename K >
struct Vector <K, Dimension_tag<3> > { typedef typename K::Vector_3 type; };

template < typename K >
struct Vector <K, Dynamic_dimension_tag> { typedef typename K::Vector_d type; };


template < typename K >
struct Iso_box <K, Dimension_tag<2> > { typedef typename K::Iso_rectangle_2 type; };

template < typename K >
struct Iso_box <K, Dimension_tag<3> > { typedef typename K::Iso_cuboid_3 type; };

template < typename K >
struct Iso_box <K, Dynamic_dimension_tag> { typedef typename K::Iso_box_d type; };


template < typename K >
struct Direction <K, Dimension_tag<2> > { typedef typename K::Direction_2 type; };

template < typename K >
struct Direction <K, Dimension_tag<3> > { typedef typename K::Direction_3 type; };

template < typename K >
struct Direction <K, Dynamic_dimension_tag> { typedef typename K::Direction_d type; };


template < typename K >
struct Line <K, Dimension_tag<2> > { typedef typename K::Line_2 type; };

template < typename K >
struct Line <K, Dimension_tag<3> > { typedef typename K::Line_3 type; };

template < typename K >
struct Line <K, Dynamic_dimension_tag> { typedef typename K::Line_d type; };


template < typename K >
struct Ray <K, Dimension_tag<2> > { typedef typename K::Ray_2 type; };

template < typename K >
struct Ray <K, Dimension_tag<3> > { typedef typename K::Ray_3 type; };

template < typename K >
struct Ray <K, Dynamic_dimension_tag> { typedef typename K::Ray_d type; };


template < typename K >
struct Segment <K, Dimension_tag<2> > { typedef typename K::Segment_2 type; };

template < typename K >
struct Segment <K, Dimension_tag<3> > { typedef typename K::Segment_3 type; };

template < typename K >
struct Segment <K, Dynamic_dimension_tag> { typedef typename K::Segment_d type; };


template < typename K >
struct Triangle <K, Dimension_tag<2> > { typedef typename K::Triangle_2 type; };

template < typename K >
struct Triangle <K, Dimension_tag<3> > { typedef typename K::Triangle_3 type; };

template < typename K >
struct Triangle <K, Dynamic_dimension_tag> { typedef typename K::Triangle_d type; };


template < typename K >
struct Tetrahedron <K, Dimension_tag<3> > { typedef typename K::Tetrahedron_3 type; };

template < typename K >
struct Tetrahedron <K, Dynamic_dimension_tag> { typedef typename K::Tetrahedron_d type; };


template < typename K >
struct Hypersphere <K, Dimension_tag<2> > { typedef typename K::Circle_2 type; };

template < typename K >
struct Hypersphere <K, Dimension_tag<3> > { typedef typename K::Sphere_3 type; };

template < typename K >
struct Hypersphere <K, Dynamic_dimension_tag> { typedef typename K::Sphere_d type; };


template < typename K >
struct Hyperplane <K, Dimension_tag<2> > { typedef typename K::Line_2 type; };

template < typename K >
struct Hyperplane <K, Dimension_tag<3> > { typedef typename K::Plane_3 type; };

template < typename K >
struct Hyperplane <K, Dynamic_dimension_tag> { typedef typename K::Hyperplane_d type; };


template < typename K >
struct Aff_transformation <K, Dimension_tag<2> >
{ typedef typename K::Aff_transformation_2 type; };

template < typename K >
struct Aff_transformation <K, Dimension_tag<3> >
{ typedef typename K::Aff_transformation_3 type; };

template < typename K >
struct Aff_transformation <K, Dynamic_dimension_tag>
{ typedef typename K::Aff_transformation_d type; };

} // namespace Access

} //namespace CGAL

#endif // CGAL_KERNEL_DIMENSION_UTILS_H