OpenPose  1.7.0
The first real-time multi-person system to jointly detect human body, hand, facial, and foot keypoints
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 
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
159 }
160 
161 #endif // OPENPOSE_CORE_POINT_HPP
#define OVERLOAD_C_OUT(className)
Definition: macros.hpp:77
Point< T > operator-(const Point< T > &point) const
Point< T > operator+(const Point< T > &point) const
bool operator>(const Point< T > &point) const
Definition: point.hpp:82
bool operator==(const Point< T > &point) const
Definition: point.hpp:112
Point< T > & operator+=(const T value)
bool operator<(const Point< T > &point) const
Definition: point.hpp:72
std::string toString() const
bool operator<=(const Point< T > &point) const
Definition: point.hpp:92
Point< T > operator-(const T value) const
bool operator!=(const Point< T > &point) const
Definition: point.hpp:122
Point(const T x=0, const T y=0)
Point< T > & operator=(const Point< T > &point)
Point< T > & operator-=(const T value)
Point< T > & operator=(Point< T > &&point)
T area() const
Definition: point.hpp:50
Point< T > & operator-=(const Point< T > &point)
Point< T > & operator+=(const Point< T > &point)
Point< T > operator/(const T value) const
Point< T > operator*(const T value) const
bool operator>=(const Point< T > &point) const
Definition: point.hpp:102
Point< T > operator+(const T value) const
Point< T > & operator/=(const T value)
Point< T > & operator*=(const T value)