Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
predicates_on_pointsS2.h
Go to the documentation of this file.
1 // ======================================================================
2 //
3 // Copyright (c) 1999 The CGAL Consortium
4 
5 // This software and related documentation is part of the Computational
6 // Geometry Algorithms Library (CGAL).
7 // This software and documentation is provided "as-is" and without warranty
8 // of any kind. In no event shall the CGAL Consortium be liable for any
9 // damage of any kind.
10 //
11 // Every use of CGAL requires a license.
12 //
13 // Academic research and teaching license
14 // - For academic research and teaching purposes, permission to use and copy
15 // the software and its documentation is hereby granted free of charge,
16 // provided that it is not a component of a commercial product, and this
17 // notice appears in all copies of the software and related documentation.
18 //
19 // Commercial licenses
20 // - A commercial license is available through Algorithmic Solutions, who also
21 // markets LEDA (http://www.algorithmic-solutions.de).
22 // - Commercial users may apply for an evaluation license by writing to
23 // Algorithmic Solutions (contact@algorithmic-solutions.com).
24 //
25 // The CGAL Consortium consists of Utrecht University (The Netherlands),
26 // ETH Zurich (Switzerland), Free University of Berlin (Germany),
27 // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
28 // (Germany), Max-Planck-Institute Saarbrucken (Germany), RISC Linz (Austria),
29 // and Tel-Aviv University (Israel).
30 //
31 // ----------------------------------------------------------------------
32 // release : CGAL-2.2
33 // release_date : 2000, September 30
34 //
35 // source : webS2/S2.lw
36 // file : include/CGAL/SimpleCartesian/predicates_on_pointsS2.h
37 // package : S2 (1.7)
38 // revision : 1.6
39 // revision_date : 27 Jun 2000
40 // author(s) : Stefan Schirra
41 // based on code by
42 // Andreas Fabri and
43 // Herve Brönnimann
44 //
45 // coordinator : MPI, Saarbrücken
46 // email : contact@cgal.org
47 // www : http://www.cgal.org
48 //
49 // ======================================================================
50 
51 
52 #ifndef CGAL_PREDICATES_ON_POINTSS2_H
53 #define CGAL_PREDICATES_ON_POINTSS2_H
54 
56 #include <CGAL/SimpleCartesian/PointS2.h>
58 
60 
61 template < class FT >
62 inline
63 bool
64 x_equal(const PointS2<FT> &p, const PointS2<FT> &q)
65 { return p.x() == q.x(); }
66 
67 template < class FT >
68 inline
69 bool
70 y_equal(const PointS2<FT> &p, const PointS2<FT> &q)
71 { return p.y() == q.y(); }
72 
73 template < class FT >
74 inline
75 bool
76 equal_xy(const PointS2<FT> &p, const PointS2<FT> &q)
77 { return (p.x() == q.x()) && (p.y() == q.y()); }
78 
79 template < class FT >
80 inline
81 bool
82 less_x(const PointS2<FT> &p, const PointS2<FT> &q)
83 { return (p.x() < q.x()); }
84 
85 template < class FT >
86 inline
87 bool
88 less_y(const PointS2<FT> &p, const PointS2<FT> &q)
89 { return (p.y() < q.y()); }
90 
91 template < class FT >
92 inline
95 { return CGAL_NTS compare(p.x(), q.x()); }
96 
97 template < class FT >
98 inline
101 { return CGAL_NTS compare(p.y(), q.y()); }
102 
103 template < class FT >
104 inline
107  const PointS2<FT>& q,
108  const PointS2<FT>& r,
109  const PointS2<FT>& s)
110 {
111  return compare_deltax_deltayC2(p.x(), q.x(), r.y(), s.y());
112 }
113 
114 template < class FT >
115 inline
118  const PointS2<FT> &q)
119 {
120  return compare_lexicographically_xyC2(p.x(),p.y(),q.x(),q.y());
121 }
122 
123 template < class FT >
124 inline
125 bool
127  const PointS2<FT> &q)
128 {
129  return ( !( compare_lexicographically_xy(p,q) == LARGER ) );
130 }
131 
132 template < class FT >
133 inline
134 bool
136  const PointS2<FT> &q)
137 {
138  return compare_lexicographically_xy(p,q) == SMALLER ;
139 }
140 
141 template < class FT >
142 inline
145  const PointS2<FT> &q)
146 {
147  return compare_lexicographically_xyC2(p.y(),p.x(),q.y(),q.x());
148 }
149 
150 
151 template < class FT >
152 inline
153 bool
155  const PointS2<FT> &q)
156 {
157  return !( compare_lexicographically_yx(p,q) == LARGER ) ;
158 }
159 
160 template < class FT >
161 inline
162 bool
164  const PointS2<FT> &q)
165 {
166  return compare_lexicographically_yx(p,q) == SMALLER ;
167 }
168 
169 template < class FT >
170 inline
173  const PointS2<FT> &q,
174  const PointS2<FT> &r)
175 {
176  return orientationC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y());
177 }
178 
179 template < class FT >
180 inline
181 bool
183  const PointS2<FT> &q,
184  const PointS2<FT> &r)
185 {
186  return (orientation(p,q,r) == COLLINEAR);
187 }
188 
189 
190 
191 template < class FT >
192 inline
193 bool
195  const PointS2<FT> &q,
196  const PointS2<FT> &r)
197 {
199  (p.x(),p.y(),q.x(),q.y(),r.x(),r.y());
200 }
201 
202 
203 template < class FT >
204 inline
205 bool
207  const PointS2<FT> &q,
208  const PointS2<FT> &r)
209 {
210  if (!collinear(p, q, r)) { return false; }
211  return collinear_are_ordered_along_line(p, q, r);
212 }
213 
214 template < class FT >
215 inline
216 bool
218  const PointS2<FT> &q,
219  const PointS2<FT> &r)
220 {
222  (p.x(),p.y(),q.x(),q.y(),r.x(),r.y());
223 }
224 
225 
226 template < class FT >
227 inline
228 bool
230  const PointS2<FT> &q,
231  const PointS2<FT> &r)
232 {
233  if (!collinear(p, q, r)) { return false; }
235 }
236 
237 template < class FT >
238 inline
239 bool
241  const PointS2<FT> &q,
242  const PointS2<FT> &r)
243 {
244  return (orientation(p,q,r) == LEFTTURN );
245 }
246 
247 template < class FT >
248 inline
249 bool
250 leftturn(const Origin &o,
251  const PointS2<FT> &q,
252  const PointS2<FT> &r)
253 {
254  return (orientationC2(FT(0), FT(0), q.x(), q.y(), r.x(), r.y())
255  == LEFTTURN );
256 }
257 
258 template < class FT >
259 inline
260 bool
262  const PointS2<FT> &q,
263  const PointS2<FT> &r)
264 {
265  return (orientationC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y())
266  == RIGHTTURN);
267 }
268 
269 template < class FT >
270 inline
271 bool
272 rightturn(const Origin &o,
273  const PointS2<FT> &q,
274  const PointS2<FT> &r)
275 {
276  return (orientationC2(FT(0), FT(0), q.x(), q.y(), r.x(), r.y())
277  == RIGHTTURN);
278 }
279 
280 template <class FT >
281 inline
284  const PointS2<FT> &q,
285  const PointS2<FT> &r,
286  const PointS2<FT> &test)
287 {
289  (p.x(),p.y(),q.x(),q.y(),r.x(),r.y(),test.x(),test.y());
290 }
291 
292 
293 template <class FT >
294 inline
297  const PointS2<FT> &q,
298  const PointS2<FT> &r,
299  const PointS2<FT> &test)
300 {
302  (p.x(),p.y(),q.x(),q.y(),r.x(),r.y(),test.x(),test.y());
303 }
304 
305 
307 
308 #endif // CGAL_PREDICATES_ON_POINTSS2_H
bool less_x(const PointS2< FT > &p, const PointS2< FT > &q)
CGAL_KERNEL_MEDIUM_INLINE bool collinear_are_strictly_ordered_along_lineC2(const FT &px, const FT &py, const FT &qx, const FT &qy, const FT &rx, const FT &ry)
Comparison_result compare_y(const Point_2< R > &p, const Point_2< R > &q)
double s
Definition: blastest.C:80
Orientation orientationC2(const FT &px, const FT &py, const FT &qx, const FT &qy, const FT &rx, const FT &ry)
const Orientation LEFTTURN
Definition: enum.h:66
bool equal_xy(const PointS2< FT > &p, const PointS2< FT > &q)
bool lexicographically_xy_smaller(const Point_2< R > &p, const Point_2< R > &q)
Comparison_result compare_deltax_deltayC2(const FT &px, const FT &qx, const FT &ry, const FT &sy)
Definition: enum.h:96
bool lexicographically_yx_smaller_or_equal(const Point_2< R > &p, const Point_2< R > &q)
bool y_equal(const Point_2< R > &p, const Point_2< R > &q)
Sign
Definition: enum.h:57
Oriented_side
Definition: enum.h:78
Comparison_result compare_deltax_deltay(const Point_2< R > &p, const Point_2< R > &q, const Point_2< R > &r, const Point_2< R > &s)
bool rightturn(const Point_2< R > &p, const Point_2< R > &q, const Point_2< R > &r)
Comparison_result compare_x(const Point_2< R > &p, const Point_2< R > &q)
Comparison_result compare_lexicographically_xyC2(const FT &px, const FT &py, const FT &qx, const FT &qy)
Oriented_side side_of_oriented_circle(const Point_2< R > &p, const Point_2< R > &q, const Point_2< R > &r, const Point_2< R > &test)
bool lexicographically_xy_smaller_or_equal(const Point_2< R > &p, const Point_2< R > &q)
bool less_y(const PointS2< FT > &p, const PointS2< FT > &q)
bool are_ordered_along_line(const Point_2< R > &p, const Point_2< R > &q, const Point_2< R > &r)
bool collinear(const Point_2< R > &p, const Point_2< R > &q, const Point_2< R > &r)
void test(void)
Definition: flotsam.C:99
CGAL_KERNEL_LARGE_INLINE Bounded_side side_of_bounded_circleC2(const FT &px, const FT &py, const FT &qx, const FT &qy, const FT &rx, const FT &ry, const FT &tx, const FT &ty)
bool collinear_are_ordered_along_line(const Point_2< R > &p, const Point_2< R > &q, const Point_2< R > &r)
bool lexicographically_yx_smaller(const Point_2< R > &p, const Point_2< R > &q)
Orientation orientation(const Point_2< R > &p, const Point_2< R > &q, const Point_2< R > &r)
bool are_strictly_ordered_along_line(const Point_2< R > &p, const Point_2< R > &q, const Point_2< R > &r)
CGAL_BEGIN_NAMESPACE bool x_equal(const Point_2< R > &p, const Point_2< R > &q)
CGAL_KERNEL_LARGE_INLINE Oriented_side side_of_oriented_circleC2(const FT &px, const FT &py, const FT &qx, const FT &qy, const FT &rx, const FT &ry, const FT &tx, const FT &ty)
Comparison_result
Definition: enum.h:94
Bounded_side
Definition: enum.h:86
Definition: enum.h:98
NT q
bool collinear_are_strictly_ordered_along_line(const Point_2< R > &p, const Point_2< R > &q, const Point_2< R > &r)
Comparison_result compare_lexicographically_xy(const Point_2< R > &p, const Point_2< R > &q)
Comparison_result compare_lexicographically_yx(const Point_2< R > &p, const Point_2< R > &q)
#define CGAL_BEGIN_NAMESPACE
Definition: kdtree_d.h:86
CGAL_KERNEL_INLINE Comparison_result compare(const NT &n1, const NT &n2)
Definition: number_utils.h:143
bool leftturn(const Point_2< R > &p, const Point_2< R > &q, const Point_2< R > &r)
#define CGAL_NTS
const Orientation RIGHTTURN
Definition: enum.h:67
const Orientation COLLINEAR
Definition: enum.h:72
#define CGAL_END_NAMESPACE
Definition: kdtree_d.h:87
CGAL_KERNEL_MEDIUM_INLINE bool collinear_are_ordered_along_lineC2(const FT &px, const FT &py, const FT &qx, const FT &qy, const FT &rx, const FT &ry)
Bounded_side side_of_bounded_circle(const Point_2< R > &p, const Point_2< R > &q, const Point_2< R > &r, const Point_2< R > &test)