DGtal  1.3.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)
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  Point2ShapePredicate &operator=( const Point2ShapePredicate & other ) = default;
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)
DGtal::functors::Point2ShapePredicate
Definition: Point2ShapePredicate.h:95
DGtal::functors::Point2ShapePredicateComparator< T, false, true >::operator()
bool operator()(const T &q, const T &t) const
Definition: Point2ShapePredicate.h:229
DGtal::functors::Point2ShapePredicate::Point
TSurface::Point Point
Definition: Point2ShapePredicate.h:100
DGtal::functors::Point2ShapePredicate::Distance
TSurface::Distance Distance
Definition: Point2ShapePredicate.h:101
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::functors::Point2ShapePredicate::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::functors::Point2ShapePredicate::Point2ShapePredicate
Point2ShapePredicate(const TSurface &aSurface)
DGtal::functors::Point2ShapePredicate::~Point2ShapePredicate
~Point2ShapePredicate()
DGtal::functors::Point2ShapePredicateComparator
Aim: A small struct with an operator that compares two values according to two bool template paramete...
Definition: Point2ShapePredicate.h:177
DGtal::functors::Point2ShapePredicate::operator()
bool operator()(const Point &p) const
DGtal::functors::Point2ShapePredicateComparator< T, false, false >::operator()
bool operator()(const T &q, const T &t) const
Definition: Point2ShapePredicate.h:207
DGtal::functors::Point2ShapePredicateComparator< T, true, false >::operator()
bool operator()(const T &q, const T &t) const
Definition: Point2ShapePredicate.h:251
DGtal::functors::Point2ShapePredicate::myS
TSurface myS
Definition: Point2ShapePredicate.h:147
DGtal::functors::Point2ShapePredicateComparator< T, true, true >::operator()
bool operator()(const T &q, const T &t) const
Definition: Point2ShapePredicate.h:273
Point
MyPointD Point
Definition: testClone2.cpp:383
DGtal::functors::Point2ShapePredicateComparator::operator()
bool operator()(const T &q, const T &t) const
Definition: Point2ShapePredicate.h:184
DGtal::functors::Point2ShapePredicate::operator=
Point2ShapePredicate & operator=(const Point2ShapePredicate &other)=default