| | #ifndef OPENPOSE_CORE_RECTANGLE_HPP |
| | #define OPENPOSE_CORE_RECTANGLE_HPP |
| |
|
| | #include <string> |
| | #include <openpose/core/macros.hpp> |
| | #include <openpose/core/point.hpp> |
| |
|
| | namespace op |
| | { |
| | template<typename T> |
| | struct Rectangle |
| | { |
| | T x; |
| | T y; |
| | T width; |
| | T height; |
| |
|
| | Rectangle(const T x = 0, const T y = 0, const T width = 0, const T height = 0); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | Rectangle<T>(const Rectangle<T>& rectangle); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | Rectangle<T>& operator=(const Rectangle<T>& rectangle); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | Rectangle<T>(Rectangle<T>&& rectangle); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | Rectangle<T>& operator=(Rectangle<T>&& rectangle); |
| |
|
| | Point<T> center() const; |
| |
|
| | inline Point<T> topLeft() const |
| | { |
| | return Point<T>{x, y}; |
| | } |
| |
|
| | Point<T> bottomRight() const; |
| |
|
| | inline T area() const |
| | { |
| | return width * height; |
| | } |
| |
|
| | void recenter(const T newWidth, const T newHeight); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | std::string toString() const; |
| |
|
| | |
| | Rectangle<T>& operator*=(const T value); |
| |
|
| | Rectangle<T> operator*(const T value) const; |
| |
|
| | Rectangle<T>& operator/=(const T value); |
| |
|
| | Rectangle<T> operator/(const T value) const; |
| | }; |
| |
|
| | |
| | template<typename T> |
| | Rectangle<T> recenter(const Rectangle<T>& rectangle, const T newWidth, const T newHeight); |
| |
|
| | OVERLOAD_C_OUT(Rectangle) |
| | } |
| |
|
| | #endif |
| |
|