DGtal  0.9.2
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 // @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 
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>
194 struct Point2ShapePredicateComparator<T,false,false> {
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>
216 struct Point2ShapePredicateComparator<T,false,true> {
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>
238 struct Point2ShapePredicateComparator<T,true,false> {
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 
274 } // namespace functors
275 
282 template <typename TSurface, bool isUpward, bool isClosed>
283 inline
284 std::ostream&
285 operator<< ( std::ostream & out,
287 
288 } // namespace DGtal
289 
290 
292 // Includes inline functions.
293 #include "DGtal/shapes/fromPoints/Point2ShapePredicate.ih"
294 
295 // //
297 
298 #endif // !defined Point2ShapePredicate_h
299 
300 #undef Point2ShapePredicate_RECURSES
301 #endif // else defined(Point2ShapePredicate_RECURSES)
Point2ShapePredicate(const TSurface &aSurface)
Aim: Predicate returning 'true' iff a given point is in the 'interior' of a given shape...
void selfDisplay(std::ostream &out) const
Aim: A small struct with an operator that compares two values according to two bool template paramete...
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal is the top-level namespace which contains all DGtal functions and types.
bool operator()(const Point &p) const
bool operator()(const T &q, const T &t) const