OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator 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>
5 
6 namespace op
7 {
8  template<typename T>
9  struct Point
10  {
11  T x;
12  T y;
13 
14  Point(const T x = 0, const T y = 0);
15 
23  Point<T>(const Point<T>& point);
24 
31  Point<T>& operator=(const Point<T>& point);
32 
38  Point<T>(Point<T>&& point);
39 
46  Point<T>& operator=(Point<T>&& point);
47 
48  inline T area() const
49  {
50  return x * y;
51  }
52 
58  std::string toString() const;
59 
60 
61 
62 
63 
64  // -------------------------------------------------- Comparison operators -------------------------------------------------- //
70  inline bool operator<(const Point<T>& point) const
71  {
72  return area() < point.area();
73  }
74 
80  inline bool operator>(const Point<T>& point) const
81  {
82  return area() > point.area();
83  }
84 
90  inline bool operator<=(const Point<T>& point) const
91  {
92  return area() <= point.area();
93  }
94 
100  inline bool operator>=(const Point<T>& point) const
101  {
102  return area() >= point.area();
103  }
104 
110  inline bool operator==(const Point<T>& point) const
111  {
112  return area() == point.area();
113  }
114 
120  inline bool operator!=(const Point<T>& point) const
121  {
122  return area() != point.area();
123  }
124 
125 
126 
127 
128 
129  // -------------------------------------------------- Basic Operators -------------------------------------------------- //
130  Point<T>& operator+=(const Point<T>& point);
131 
132  Point<T> operator+(const Point<T>& point) const;
133 
134  Point<T>& operator+=(const T value);
135 
136  Point<T> operator+(const T value) const;
137 
138  Point<T>& operator-=(const Point<T>& point);
139 
140  Point<T> operator-(const Point<T>& point) const;
141 
142  Point<T>& operator-=(const T value);
143 
144  Point<T> operator-(const T value) const;
145 
146  Point<T>& operator*=(const T value);
147 
148  Point<T> operator*(const T value) const;
149 
150  Point<T>& operator/=(const T value);
151 
152  Point<T> operator/(const T value) const;
153  };
154 }
155 
156 #endif // OPENPOSE_CORE_POINT_HPP
Point(const T x=0, const T y=0)
std::string toString() const
T y
Definition: point.hpp:12
bool operator!=(const Point< T > &point) const
Definition: point.hpp:120
Point< T > operator+(const Point< T > &point) const
Point< T > & operator=(const Point< T > &point)
Definition: point.hpp:9
Point< T > & operator*=(const T value)
Point< T > & operator-=(const Point< T > &point)
bool operator==(const Point< T > &point) const
Definition: point.hpp:110
bool operator>=(const Point< T > &point) const
Definition: point.hpp:100
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:80
Point< T > & operator+=(const Point< T > &point)
Point< T > & operator/=(const T value)
T area() const
Definition: point.hpp:48
T x
Definition: point.hpp:11
Point< T > operator/(const T value) const