Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
predicate_objects_on_points_2.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 // file : include/CGAL/predicate_objects_on_points_2.h
36 // package : Convex_hull (3.3)
37 // source : convex_hull_2.lw
38 // revision : 3.3
39 // revision_date : 03 Aug 2000
40 // author(s) : Stefan Schirra
41 //
42 // coordinator : MPI, Saarbruecken
43 // email : contact@cgal.org
44 // www : http://www.cgal.org
45 //
46 // ======================================================================
47 
48 
49 #ifndef CGAL_PREDICATE_OBJECTS_ON_POINTS_2_H
50 #define CGAL_PREDICATE_OBJECTS_ON_POINTS_2_H
51 
52 #include <CGAL/user_classes.h>
53 
55 template <class Point>
57 {
58 public:
59  p_Left_of_line_2p(const Point& a, const Point& b)
60  : p_a(a), p_b(b)
61  {}
62 
63  bool operator()(const Point& c) const
64  { return leftturn( p_a, p_b, c ); }
65 
66 private:
67  Point p_a;
68  Point p_b;
69 };
70 
71 template <class Point>
73 {
74 public:
75  p_Right_of_line_2p(const Point& a, const Point& b)
76  : p_a(a), p_b(b)
77  {}
78 
79  bool operator()(const Point& c) const
80  { return rightturn( p_a, p_b, c ); }
81 
82 private:
83  Point p_a;
84  Point p_b;
85 };
86 
87 template <class Point>
89 {
90 public:
91  p_Left_of_line_2p_safer(const Point& a, const Point& b)
92  : p_a(a), p_b(b)
93  {}
94 
95  bool operator()(const Point& c) const
96  {
97  if ( (c == p_a) || ( c == p_b ) ) return false;
98  return leftturn( p_a, p_b, c );
99  }
100 
101 private:
102  Point p_a;
103  Point p_b;
104 };
105 
106 
107 template <class Point>
108 struct p_Less_xy
109 {
110  bool operator()( const Point& p1, const Point& p2) const
111  { return lexicographically_xy_smaller( p1, p2); }
112 };
113 
114 template <class Point>
116 {
117  bool operator()( const Point& p1, const Point& p2) const
118  { return lexicographically_xy_larger( p1, p2); }
119 };
120 
121 template <class Point>
122 struct p_Less_yx
123 {
124  bool operator()( const Point& p1, const Point& p2) const
125  { return lexicographically_yx_smaller( p1, p2); }
126 };
127 
128 template <class Point>
130 {
131  bool operator()( const Point& p1, const Point& p2) const
132  { return lexicographically_yx_larger( p1, p2); }
133 };
134 
135 template <class Point>
137 {
138 public:
139  p_Less_dist_to_line_2p(const Point& a, const Point& b)
140  : p_a(a), p_b(b)
141  {}
142 
143  bool operator()(const Point& c, const Point& d) const
144  {
146  res = cmp_signed_dist_to_line( p_a, p_b, c, d);
147  if ( res == LARGER )
148  {
149  return false;
150  }
151  else if ( res == SMALLER )
152  {
153  return true;
154  }
155  else
156  {
157  return lexicographically_xy_smaller( c, d );
158  }
159  }
160 
161 private:
162  Point p_a;
163  Point p_b;
164 };
165 
166 template <class Point>
168 {
169 public:
170  p_Less_negative_dist_to_line_2p(const Point& a, const Point& b)
171  : p_a(a), p_b(b)
172  {}
173 
174  bool operator()(const Point& c, const Point& d) const
175  {
177  res = cmp_signed_dist_to_line( p_a, p_b, c, d);
178  if ( res == LARGER )
179  {
180  return true;
181  }
182  else if ( res == SMALLER )
183  {
184  return false;
185  }
186  else
187  {
188  return lexicographically_xy_smaller( c, d );
189  }
190  }
191 
192 private:
193  Point p_a;
194  Point p_b;
195 };
196 
197 template <class Point>
199 {
200 public:
201  p_Less_rotate_ccw(const Point& p)
202  : rot_point(p)
203  {}
204 
205  bool operator()(const Point& p, const Point& q) const
206  {
207  Orientation ori = orientation(rot_point, p, q);
208  if ( ori == LEFTTURN )
209  {
210  return true;
211  }
212  else if ( ori == RIGHTTURN )
213  {
214  return false;
215  }
216  else
217  {
218  if (p == rot_point) return false;
219  if (q == rot_point) return true;
220  if (p == q) return false;
222  }
223  }
224 
225  void set_rotation_center( const Point& p)
226  { rot_point = p; }
227 
228 
229 private:
230  Point rot_point;
231 };
232 
233 template <class Point>
235 {
236 public:
237  p_Less_rotate_ccw_safer(const Point& p)
238  : rot_point(p)
239  {}
240 
241  bool operator()(const Point& p, const Point& q) const
242  {
243  if (p == rot_point) return false;
244  if (q == rot_point) return true;
245  if (p == q) return false;
246  Orientation ori = orientation(rot_point, p, q);
247  if ( ori == LEFTTURN )
248  {
249  return true;
250  }
251  else if ( ori == RIGHTTURN )
252  {
253  return false;
254  }
255  else
256  {
258  }
259  }
260 
261  void set_rotation_center( const Point& p)
262  { rot_point = p; }
263 
264 
265 private:
266  Point rot_point;
267 };
268 
269 template <class Point>
271 {
272 public:
273  p_Less_rotate_ccw_E(const Point& p)
274  : rot_point(p)
275  {}
276 
277  bool operator()(const Point& p, const Point& q) const
278  {
279  Orientation ori = orientation(rot_point, p, q);
280  if ( ori == LEFTTURN )
281  {
282  return true;
283  }
284  else if ( ori == RIGHTTURN )
285  {
286  return false;
287  }
288  else
289  {
290  return has_larger_dist_to_point( rot_point, p, q) ;
291  }
292  }
293 
294  void set_rotation_center( const Point& p)
295  { rot_point = p; }
296 
297 
298 private:
299  Point rot_point;
300 };
301 
302 template <class R>
304 {
305 public:
306  typedef typename R::Point_2 Point;
307  typedef typename R::Line_2 Line;
308  r_Right_of_line(const Point& a, const Point& b)
309  : l_ab( a, b )
310  {}
311 
312  bool
313  operator()(const Point& c) const
314  {
315  if ( l_ab.is_degenerate() ) return false;
316  return (l_ab.oriented_side(c) == ON_NEGATIVE_SIDE);
317  }
318 
319 private:
321 };
322 
323 template <class R>
325 {
326 public:
327  typedef typename R::Point_2 Point;
328  typedef typename R::Line_2 Line;
329  r_Left_of_line(const Point& a, const Point& b)
330  : l_ab( a, b ), is_deg( a == b)
331  {}
332 
333  bool
334  operator()(const Point& c) const
335  { return ( !is_deg && (l_ab.oriented_side(c) == ON_POSITIVE_SIDE)); }
336 
337 private:
339  bool is_deg;
340 };
341 
342 template <class Point>
344 {
345  public:
346  p_Less_dist_to_point( const Point& p) : _p(p) {}
347  bool operator()( const Point& p1, const Point& p2) const
348  { return has_smaller_dist_to_point(_p, p1, p2); }
349  private:
350  Point _p;
351 };
352 
353 template <class R>
355 {
356 public:
357  typedef typename R::Point_2 Point;
358  typedef typename R::Line_2 Line;
360  const Point& b)
361  : l_ab( a, b )
362  {}
363 
364  bool operator()(const Point& c, const Point& d) const
365  {
366  Comparison_result res = cmp_signed_dist_to_line(l_ab, c, d);
367  if ( res == SMALLER )
368  {
369  return false;
370  }
371  else if ( res == EQUAL )
372  {
373  return lexicographically_xy_smaller( c, d );
374  }
375  else
376  {
377  return true;
378  }
379  }
380 
381 private:
383 };
384 
385 template <class R>
387 {
388 public:
389  typedef typename R::Point_2 Point;
390  typedef typename R::Line_2 Line;
391  r_Less_dist_to_line(const Point& a, const Point& b)
392  : l_ab( a, b )
393  {}
394 
395  bool operator()(const Point& c, const Point& d) const
396  {
397  Comparison_result res = cmp_signed_dist_to_line(l_ab, c, d);
398  if ( res == SMALLER )
399  {
400  return true;
401  }
402  else if ( res == EQUAL )
403  {
404  return lexicographically_xy_smaller( c, d );
405  }
406  else
407  {
408  return false;
409  }
410  }
411 
412 private:
414 };
415 
416 template <class R>
418 {
419 public:
420  typedef typename R::RT RT;
421  typedef typename R::Direction_2 Direction;
422  typedef typename R::Point_2 Point;
423  typedef typename R::Line_2 Line;
424 
426  : l( Point( RT(0) , RT(0) ),
427  Direction(-(dir.dy()), dir.dx() ))
428  {}
429 
430  bool operator()(const Point& c, const Point& d) const
431  {
432  Comparison_result res = cmp_signed_dist_to_line(l, c, d);
433  if ( res == LARGER )
434  {
435  return true;
436  }
437  else if ( res == EQUAL )
438  {
439  return lexicographically_xy_smaller( c, d) ;
440  }
441  else
442  {
443  return false;
444  }
445  }
446 
447 private:
449 };
450 
451 template <class Point>
453 {
454  bool operator()(const Point& p, const Point& q, const Point& r) const
455  { return leftturn(p,q,r); }
456 };
457 
458 template <class Point>
460 {
461  bool operator()(const Point& p, const Point& q, const Point& r) const
462  { return rightturn(p,q,r); }
463 };
464 
465 template <class Point>
467 {
468  Orientation
469  operator()(const Point& p, const Point& q, const Point& r) const
470  { return orientation(p,q,r); }
471  Orientation
472  operator()(const Point& p, const Point& q, const Point& r, const Point& s) const
473  { return orientation(p,q,r,s); }
474 };
475 
477 
478 #endif // CGAL_PREDICATE_OBJECTS_ON_POINTS_2_H
bool operator()(const Point &p1, const Point &p2) const
bool operator()(const Point &p, const Point &q) const
const NT & d
NT dx
double s
Definition: blastest.C:80
bool operator()(const Point &c, const Point &d) const
bool operator()(const Point &c) const
NT p1
p_Left_of_line_2p_safer(const Point &a, const Point &b)
bool operator()(const Point &p, const Point &q, const Point &r) const
bool lexicographically_xy_larger(const Point_2< R > &p, const Point_2< R > &q)
const Orientation LEFTTURN
Definition: enum.h:66
bool lexicographically_xy_smaller(const Point_2< R > &p, const Point_2< R > &q)
bool operator()(const Point &c, const Point &d) const
bool operator()(const Point &p1, const Point &p2) const
Orientation operator()(const Point &p, const Point &q, const Point &r, const Point &s) const
bool operator()(const Point &c) const
Definition: enum.h:96
p_Right_of_line_2p(const Point &a, const Point &b)
CGAL_KERNEL_LARGE_INLINE bool has_larger_dist_to_point(const PointS3< FT > &p, const PointS3< FT > &q, const PointS3< FT > &r)
Sign
Definition: enum.h:57
bool operator()(const Point &c) const
bool operator()(const Point &c) const
r_Right_of_line(const Point &a, const Point &b)
bool operator()(const Point &p1, const Point &p2) const
bool operator()(const Point &c, const Point &d) const
bool rightturn(const Point_2< R > &p, const Point_2< R > &q, const Point_2< R > &r)
bool operator()(const Point &c, const Point &d) const
bool operator()(const Point &c) const
bool operator()(const Point &p, const Point &q) const
bool operator()(const Point &p, const Point &q, const Point &r) const
bool operator()(const Point &c, const Point &d) const
bool operator()(const Point &p1, const Point &p2) const
bool collinear_are_ordered_along_line(const Point_2< R > &p, const Point_2< R > &q, const Point_2< R > &r)
p_Left_of_line_2p(const Point &a, const Point &b)
r_Less_in_direction(const Direction &dir)
void set_rotation_center(const Point &p)
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)
p_Less_dist_to_line_2p(const Point &a, const Point &b)
Orientation operator()(const Point &p, const Point &q, const Point &r) const
bool operator()(const Point &p, const Point &q) const
Comparison_result
Definition: enum.h:94
void set_rotation_center(const Point &p)
NT dy
Definition: enum.h:98
NT q
CGAL_KERNEL_LARGE_INLINE bool has_smaller_dist_to_point(const PointS3< FT > &p, const PointS3< FT > &q, const PointS3< FT > &r)
p_Less_negative_dist_to_line_2p(const Point &a, const Point &b)
Definition: enum.h:97
#define CGAL_BEGIN_NAMESPACE
Definition: kdtree_d.h:86
r_Left_of_line(const Point &a, const Point &b)
r_Less_dist_to_line(const Point &a, const Point &b)
bool lexicographically_yx_larger(const Point_2< R > &p, const Point_2< R > &q)
bool leftturn(const Point_2< R > &p, const Point_2< R > &q, const Point_2< R > &r)
const Orientation RIGHTTURN
Definition: enum.h:67
r_Less_negative_dist_to_line(const Point &a, const Point &b)
#define CGAL_END_NAMESPACE
Definition: kdtree_d.h:87
SURF::Vector_2< Real > Point_2
Definition: rfc_basic.h:43
bool operator()(const Point &p1, const Point &p2) const