1 // Copyright (c) 1999
2 // Utrecht University (The Netherlands),
3 // ETH Zurich (Switzerland),
4 // INRIA Sophia-Antipolis (France),
5 // Max-Planck-Institute Saarbruecken (Germany),
6 // and Tel-Aviv University (Israel). All rights reserved.
7 //
8 // This file is part of CGAL (www.cgal.org)
9 //
10 // $URL: https://github.com/CGAL/cgal/blob/v5.3/Kernel_23/include/CGAL/enum.h $
11 // $Id: enum.h 5c8df66 2020-09-25T14:25:14+02:00 Jane Tournois
12 // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
13 //
14 //
15 // Author(s) : Stefan Schirra
16
17 #ifndef CGAL_ENUM_H
18 #define CGAL_ENUM_H
19
20 #include <CGAL/config.h>
21 #include <CGAL/Kernel/Same_uncertainty.h>
22 #include <CGAL/Origin.h>
23
24 // If you add/change one type here, please update Is_a_predicate.h as well.
25
26 namespace CGAL {
27
28 enum Sign
29 {
30 NEGATIVE = -1, ZERO = 0, POSITIVE = 1,
31
32 // Orientation constants:
33 RIGHT_TURN = -1, LEFT_TURN = 1,
34
35 CLOCKWISE = -1, COUNTERCLOCKWISE = 1,
36
37 COLLINEAR = 0, COPLANAR = 0, DEGENERATE = 0,
38
39 // Oriented_side constants:
40 ON_NEGATIVE_SIDE = -1, ON_ORIENTED_BOUNDARY = 0, ON_POSITIVE_SIDE = 1,
41
42 // Comparison_result constants:
43 SMALLER = -1, EQUAL = 0, LARGER = 1
44 };
45
46 typedef Sign Orientation;
47 typedef Sign Oriented_side;
48 typedef Sign Comparison_result;
49
50 enum Bounded_side
51 {
52 ON_UNBOUNDED_SIDE = -1,
53 ON_BOUNDARY,
54 ON_BOUNDED_SIDE
55 };
56
57 enum Angle
58 {
59 OBTUSE = -1,
60 RIGHT,
61 ACUTE
62 };
63
64
65 template <class T>
66 inline
67 T
opposite(const T & t)68 opposite(const T& t)
69 { return -t; }
70
71 inline
72 Sign
73 operator-(Sign o)
74 { return static_cast<Sign>( - static_cast<int>(o)); }
75
76 inline
77 Bounded_side
opposite(Bounded_side bs)78 opposite(Bounded_side bs)
79 { return static_cast<Bounded_side>( - static_cast<int>(bs)); }
80
81 inline
82 Angle
opposite(Angle a)83 opposite(Angle a)
84 { return static_cast<Angle>( - static_cast<int>(a)); }
85
86 inline Sign operator* (Sign s1, Sign s2)
87 {
88 return static_cast<Sign> (static_cast<int> (s1) * static_cast<int> (s2));
89 }
90
91
92 enum Box_parameter_space_2
93 {
94 LEFT_BOUNDARY = 0,
95 RIGHT_BOUNDARY,
96 BOTTOM_BOUNDARY,
97 TOP_BOUNDARY,
98 INTERIOR,
99 EXTERIOR
100 };
101
102 template < typename T, typename U >
103 inline
enum_cast(const U & u)104 T enum_cast(const U& u)
105 { return static_cast<T>(u); }
106
107 } //namespace CGAL
108
109 #endif // CGAL_ENUM_H
110