OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
point.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_CORE_POINT_HPP
2 #define OPENPOSE_CORE_POINT_HPP
3 
4 #include <string>
6 
7 namespace op
8 {
9  template<typename T>
10  struct Point
11  {
12  T x;
13  T y;
14 
15  Point(const T x = 0, const T y = 0);
16 
25  Point<T>(const Point<T>& point);
26 
33  Point<T>& operator=(const Point<T>& point);
34 
40  Point<T>(Point<T>&& point);
41 
48  Point<T>& operator=(Point<T>&& point);
49 
50  inline T area() const
51  {
52  return x * y;
53  }
54 
60  std::string toString() const;
61 
62 
63 
64 
65 
66  // ------------------------------ Comparison operators ------------------------------ //
72  inline bool operator<(const Point<T>& point) const
73  {
74  return area() < point.area();
75  }
76 
82  inline bool operator>(const Point<T>& point) const
83  {
84  return area() > point.area();
85  }
86 
92  inline bool operator<=(const Point<T>& point) const
93  {
94  return area() <= point.area();
95  }
96 
102  inline bool operator>=(const Point<T>& point) const
103  {
104  return area() >= point.area();
105  }
106 
112  inline bool operator==(const Point<T>& point) const
113  {
114  return area() == point.area();
115  }
116 
122  inline bool operator!=(const Point<T>& point) const
123  {
124  return area() != point.area();
125  }
126 
127 
128 
129 
130 
131  // ------------------------------ Basic Operators ------------------------------ //
132  Point<T>& operator+=(const Point<T>& point);
133 
134  Point<T> operator+(const Point<T>& point) const;
135 
136  Point<T>& operator+=(const T value);
137 
138  Point<T> operator+(const T value) const;
139 
140  Point<T>& operator-=(const Point<T>& point);
141 
142  Point<T> operator-(const Point<T>& point) const;
143 
144  Point<T>& operator-=(const T value);
145 
146  Point<T> operator-(const T value) const;
147 
148  Point<T>& operator*=(const T value);
149 
150  Point<T> operator*(const T value) const;
151 
152  Point<T>& operator/=(const T value);
153 
154  Point<T> operator/(const T value) const;
155  };
156 
157  // Static methods
158  OVERLOAD_C_OUT(Point)
159 }
160 
161 #endif // OPENPOSE_CORE_POINT_HPP
Point(const T x=0, const T y=0)
std::string toString() const
T y
Definition: point.hpp:13
bool operator!=(const Point< T > &point) const
Definition: point.hpp:122
Point< T > operator+(const Point< T > &point) const
Point< T > & operator=(const Point< T > &point)
Definition: point.hpp:10
Point< T > & operator*=(const T value)
#define OVERLOAD_C_OUT(className)
Definition: macros.hpp:60
Point< T > & operator-=(const Point< T > &point)
bool operator==(const Point< T > &point) const
Definition: point.hpp:112
bool operator>=(const Point< T > &point) const
Definition: point.hpp:102
Point< T > operator*(const T value) const
Point< T > operator-(const Point< T > &point) const
bool operator>(const Point< T > &point) const
Definition: point.hpp:82
Point< T > & operator+=(const Point< T > &point)
Point< T > & operator/=(const T value)
T area() const
Definition: point.hpp:50
T x
Definition: point.hpp:12
Point< T > operator/(const T value) const
std::string string
Definition: cl2.hpp:574