DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Point2ShapePredicate.ih
1 
30 
31 #include <cstdlib>
33 
35 // IMPLEMENTATION of inline methods.
37 
39 // ----------------------- Standard services ------------------------------
40 
41 
42 template <typename TSurface, bool isUpward, bool isClosed>
43 inline
45 {
46 }
47 
48 template <typename TSurface, bool isUpward, bool isClosed>
49 inline
51  const TSurface& aSurface):
52  myS(aSurface)
53 {
54 }
55 
60 template <typename TSurface, bool isUpward, bool isClosed>
61 inline
63  const Point2ShapePredicate & other):
64  myS(other.myS)
65 {
66 }
67 
68 
69 template <typename TSurface, bool isUpward, bool isClosed>
70 inline
71 bool
73 ::operator()(const Point& p) const
74 {
76  Distance,
77  isUpward,
78  isClosed> theComparator;
79 
80  return theComparator(myS.signedDistance(p),0);
81 }
82 
83 
84 
86 // Interface - public :
87 
88 template <typename TSurface, bool isUpward, bool isClosed>
89 inline
90 void
92 ::selfDisplay ( std::ostream & out ) const
93 {
94  out << "[Point2ShapePredicate] :\n";
95  myS.selfDisplay(out);
96  out << "\n";
97  std::string orientation = (isUpward)?
98  "upward oriented":"downward oriented";
99  std::string closure = (isClosed)?
100  "closed":"open";
101  out << "(" << orientation << ", " << closure << ")\n";
102 
103 }
104 
106 // Implementation of inline functions //
107 
108 template <typename TSurface, bool isUpward, bool isClosed>
109 inline
110 std::ostream&
111 DGtal::operator<< ( std::ostream & out,
113 {
114  object.selfDisplay( out );
115  return out;
116 }
117