All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
rectangle.hpp
Go to the documentation of this file.
#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;
// ------------------------------ Basic Operators ------------------------------ //
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;
};
// Static methods
template<typename T>
Rectangle<T> recenter(const Rectangle<T>& rectangle, const T newWidth, const T newHeight);
OVERLOAD_C_OUT(Rectangle)
}
#endif // OPENPOSE_CORE_RECTANGLE_HPP
op::Rectangle::center
Point< T > center() const
op::Rectangle::operator=
Rectangle< T > & operator=(const Rectangle< T > &rectangle)
point.hpp
op::Rectangle::Rectangle
Rectangle(const T x=0, const T y=0, const T width=0, const T height=0)
op::Rectangle::y
T y
Definition: rectangle.hpp:14
op::Rectangle::recenter
void recenter(const T newWidth, const T newHeight)
op::Point
Definition: point.hpp:10
OVERLOAD_C_OUT
#define OVERLOAD_C_OUT(className)
Definition: macros.hpp:61
op::Rectangle::operator/
Rectangle< T > operator/(const T value) const
op::Rectangle::operator/=
Rectangle< T > & operator/=(const T value)
op::Rectangle::toString
std::string toString() const
op::Rectangle::bottomRight
Point< T > bottomRight() const
op::Rectangle::operator*
Rectangle< T > operator*(const T value) const
op::Rectangle::height
T height
Definition: rectangle.hpp:16
macros.hpp
op::Rectangle::topLeft
Point< T > topLeft() const
Definition: rectangle.hpp:55
op::Rectangle::width
T width
Definition: rectangle.hpp:15
op::Rectangle::x
T x
Definition: rectangle.hpp:13
op::Rectangle::operator*=
Rectangle< T > & operator*=(const T value)
op::Rectangle
Definition: rectangle.hpp:11
op::recenter
Rectangle< T > recenter(const Rectangle< T > &rectangle, const T newWidth, const T newHeight)
op::Rectangle::area
T area() const
Definition: rectangle.hpp:62
cl::string
std::string string
Definition: cl2.hpp:574