OpenPose  1.7.0
The first real-time multi-person system to jointly detect human body, hand, facial, and foot keypoints
rectangle.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_CORE_RECTANGLE_HPP
2 #define OPENPOSE_CORE_RECTANGLE_HPP
3 
4 #include <string>
7 
8 namespace op
9 {
10  template<typename T>
11  struct Rectangle
12  {
13  T x;
14  T y;
15  T width;
16  T height;
17 
18  Rectangle(const T x = 0, const T y = 0, const T width = 0, const T height = 0);
19 
28  Rectangle<T>(const Rectangle<T>& rectangle);
29 
36  Rectangle<T>& operator=(const Rectangle<T>& rectangle);
37 
43  Rectangle<T>(Rectangle<T>&& rectangle);
44 
52 
53  Point<T> center() const;
54 
55  inline Point<T> topLeft() const
56  {
57  return Point<T>{x, y};
58  }
59 
61 
62  inline T area() const
63  {
64  return width * height;
65  }
66 
67  void recenter(const T newWidth, const T newHeight);
68 
74  std::string toString() const;
75 
76  // ------------------------------ Basic Operators ------------------------------ //
77  Rectangle<T>& operator*=(const T value);
78 
79  Rectangle<T> operator*(const T value) const;
80 
81  Rectangle<T>& operator/=(const T value);
82 
83  Rectangle<T> operator/(const T value) const;
84  };
85 
86  // Static methods
87  template<typename T>
88  Rectangle<T> recenter(const Rectangle<T>& rectangle, const T newWidth, const T newHeight);
89 
91 }
92 
93 #endif // OPENPOSE_CORE_RECTANGLE_HPP
#define OVERLOAD_C_OUT(className)
Definition: macros.hpp:77
Rectangle< T > recenter(const Rectangle< T > &rectangle, const T newWidth, const T newHeight)
Rectangle(const T x=0, const T y=0, const T width=0, const T height=0)
Point< T > center() const
void recenter(const T newWidth, const T newHeight)
Rectangle< T > & operator*=(const T value)
T area() const
Definition: rectangle.hpp:62
Point< T > topLeft() const
Definition: rectangle.hpp:55
Rectangle< T > & operator/=(const T value)
Rectangle< T > operator*(const T value) const
Point< T > bottomRight() const
Rectangle< T > & operator=(const Rectangle< T > &rectangle)
Rectangle< T > & operator=(Rectangle< T > &&rectangle)
Rectangle< T > operator/(const T value) const
std::string toString() const