DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Point2ShapePredicate.h
1 
17 #pragma once
18 
31 #if defined(Point2ShapePredicate_RECURSES)
32 #error Recursive header files inclusion detected in Point2ShapePredicate.h
33 #else // defined(Point2ShapePredicate_RECURSES)
34 
35 #define Point2ShapePredicate_RECURSES
36 
37 #if !defined Point2ShapePredicate_h
38 
39 #define Point2ShapePredicate_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <functional>
45 
46 #include "DGtal/base/Common.h"
48 
49 namespace DGtal
50 {
51 
52 
54  // template class Point2ShapePredicate
94  template <typename TSurface, bool isUpward, bool isClosed>
96  {
97  // ----------------------- Standard services ------------------------------
98  public:
99 
100  typedef typename TSurface::Point Point;
101  typedef typename TSurface::Distance Distance;
102 
107  Point2ShapePredicate(const TSurface& aSurface);
108 
113  Point2ShapePredicate ( const Point2ShapePredicate & other );
114 
119  bool operator()( const Point & p ) const;
120 
125  void selfDisplay ( std::ostream & out ) const;
126 
127 
132 
133 
134  // ------------------------- Protected Datas ------------------------------
135  private:
136  // ------------------------- Private Datas --------------------------------
137  private:
141  TSurface myS;
142  // ------------------------- Hidden services ------------------------------
143  protected:
144 
145 
146  private:
147 
148  // ------------------------- Internals ------------------------------------
149  private:
150 
151  }; // end of class Point2ShapePredicate
152 
154 // policy classes for Point2ShapePredicate
156 // template class Point2ShapePredicateComparator
170 template <typename T, bool b1, bool b2>
178  bool operator()(const T& q,
179  const T& t) const {
180  std::less<T> c;
181  return c(q,t);
182  }
183 };
184 
193 template <typename T>
201  bool operator()(const T& q,
202  const T& t) const {
203  std::less<T> c;
204  return c(q,t);
205  }
206 };
215 template <typename T>
223  bool operator()(const T& q,
224  const T& t) const {
225  std::less_equal<T> c;
226  return c(q,t);
227  }
228 };
237 template <typename T>
245  bool operator()(const T& q,
246  const T& t) const {
247  std::greater<T> c;
248  return c(q,t);
249  }
250 };
259 template <typename T>
260 struct Point2ShapePredicateComparator<T,true,true> {
267  bool operator()(const T& q,
268  const T& t) const {
269  std::greater_equal<T> c;
270  return c(q,t);
271  }
272 };
273 
280 template <typename TSurface, bool isUpward, bool isClosed>
281 inline
282 std::ostream&
283 operator<< ( std::ostream & out,
285 
286 } // namespace DGtal
287 
288 
290 // Includes inline functions.
291 #include "DGtal/shapes/fromPoints/Point2ShapePredicate.ih"
292 
293 // //
295 
296 #endif // !defined Point2ShapePredicate_h
297 
298 #undef Point2ShapePredicate_RECURSES
299 #endif // else defined(Point2ShapePredicate_RECURSES)