DGtal  1.4.beta
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)
35 #define Point2ShapePredicate_RECURSES
36 
37 #if !defined Point2ShapePredicate_h
39 #define Point2ShapePredicate_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <functional>
45 
46 #include "DGtal/base/Common.h"
48 
49 // @since 0.8 In DGtal::functors
50 namespace DGtal {
51  namespace functors {
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 
114 
120 
125  bool operator()( const Point & p ) const;
126 
131  void selfDisplay ( std::ostream & out ) const;
132 
133 
138 
139 
140  // ------------------------- Protected Datas ------------------------------
141  private:
142  // ------------------------- Private Datas --------------------------------
143  private:
147  TSurface myS;
148  // ------------------------- Hidden services ------------------------------
149  protected:
150 
151 
152  private:
153 
154  // ------------------------- Internals ------------------------------------
155  private:
156 
157  }; // end of class Point2ShapePredicate
158 
160 // policy classes for Point2ShapePredicate
162 // template class Point2ShapePredicateComparator
176 template <typename T, bool b1, bool b2>
184  bool operator()(const T& q,
185  const T& t) const {
186  std::less<T> c;
187  return c(q,t);
188  }
189 };
190 
199 template <typename T>
200 struct Point2ShapePredicateComparator<T,false,false> {
207  bool operator()(const T& q,
208  const T& t) const {
209  std::less<T> c;
210  return c(q,t);
211  }
212 };
221 template <typename T>
222 struct Point2ShapePredicateComparator<T,false,true> {
229  bool operator()(const T& q,
230  const T& t) const {
231  std::less_equal<T> c;
232  return c(q,t);
233  }
234 };
243 template <typename T>
244 struct Point2ShapePredicateComparator<T,true,false> {
251  bool operator()(const T& q,
252  const T& t) const {
253  std::greater<T> c;
254  return c(q,t);
255  }
256 };
265 template <typename T>
266 struct Point2ShapePredicateComparator<T,true,true> {
273  bool operator()(const T& q,
274  const T& t) const {
275  std::greater_equal<T> c;
276  return c(q,t);
277  }
278 };
279 
280 } // namespace functors
281 
288 template <typename TSurface, bool isUpward, bool isClosed>
289 inline
290 std::ostream&
291 operator<< ( std::ostream & out,
293 
294 } // namespace DGtal
295 
296 
298 // Includes inline functions.
299 #include "DGtal/shapes/fromPoints/Point2ShapePredicate.ih"
300 
301 // //
303 
304 #endif // !defined Point2ShapePredicate_h
305 
306 #undef Point2ShapePredicate_RECURSES
307 #endif // else defined(Point2ShapePredicate_RECURSES)
Point2ShapePredicate(const Point2ShapePredicate &other)
Point2ShapePredicate & operator=(const Point2ShapePredicate &other)=default
Point2ShapePredicate(const TSurface &aSurface)
void selfDisplay(std::ostream &out) const
bool operator()(const Point &p) const
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
Aim: A small struct with an operator that compares two values according to two bool template paramete...
bool operator()(const T &q, const T &t) const
MyPointD Point
Definition: testClone2.cpp:383