All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
op::Rectangle< T > Struct Template Reference

`#include <rectangle.hpp>`

## Public Member Functions

| Rectangle (const T x=0, const T y=0, const T width=0, const T height=0)
| Rectangle (const Rectangle< T > &rectangle)
Rectangle< T > & | operator= (const Rectangle< T > &rectangle)
| Rectangle (Rectangle< T > &&rectangle)
Rectangle< T > & | operator= (Rectangle< T > &&rectangle)
Point< T > | center () const
Point< T > | topLeft () const
Point< T > | bottomRight () const
T | area () const
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

## Public Attributes

T | x
T | y
T | width
T | height

## Constructor & Destructor Documentation

template<typename T>

op::Rectangle< T >::Rectangle | ( | const T | x = `0`,
|  | const T | y = `0`,
|  | const T | width = `0`,
|  | const T | height = `0`
| ) |  |

template<typename T>

op::Rectangle< T >::Rectangle | ( | const Rectangle< T > & | rectangle | ) |

Copy constructor. It performs `fast copy`: For performance purpose, copying a Rectangle<T> or Datum or cv::Mat just copies the reference, it still shares the same internal data. Modifying the copied element will modify the original one. Use clone() for a slower but real copy, similarly to cv::Mat and Rectangle<T>.

Parameters

  rectangle | Rectangle to be copied.

template<typename T>

op::Rectangle< T >::Rectangle | ( | Rectangle< T > && | rectangle | ) |

Move constructor. It destroys the original Rectangle to be moved.

Parameters

  rectangle | Rectangle to be moved.

## Member Function Documentation

template<typename T>

T op::Rectangle< T >::area | ( |  | ) | const

inline

template<typename T>

Point<T> op::Rectangle< T >::bottomRight | ( |  | ) | const

template<typename T>

Point<T> op::Rectangle< T >::center | ( |  | ) | const

template<typename T>

Rectangle<T> op::Rectangle< T >::operator* | ( | const T | value | ) | const

template<typename T>

Rectangle<T>& op::Rectangle< T >::operator*= | ( | const T | value | ) |

template<typename T>

Rectangle<T> op::Rectangle< T >::operator/ | ( | const T | value | ) | const

template<typename T>

Rectangle<T>& op::Rectangle< T >::operator/= | ( | const T | value | ) |

template<typename T>

Rectangle<T>& op::Rectangle< T >::operator= | ( | const Rectangle< T > & | rectangle | ) |

Copy assignment. Similar to Rectangle<T>(const Rectangle<T>& rectangle).

Parameters

  rectangle | Rectangle to be copied.

Returns
  The resulting Rectangle.

template<typename T>

Rectangle<T>& op::Rectangle< T >::operator= | ( | Rectangle< T > && | rectangle | ) |

Move assignment. Similar to Rectangle<T>(Rectangle<T>&& rectangle).

Parameters

  rectangle | Rectangle to be moved.

Returns
  The resulting Rectangle.

template<typename T>

void op::Rectangle< T >::recenter | ( | const T | newWidth,
|  | const T | newHeight
| ) |  |

template<typename T>

Point<T> op::Rectangle< T >::topLeft | ( |  | ) | const

inline

template<typename T>

std::string op::Rectangle< T >::toString | ( |  | ) | const

It returns a string with the whole Rectangle<T> data. Useful for debugging. The format is: `[x, y, width, height]`

Returns
  A string with the Rectangle<T> values in the above format.

## Member Data Documentation

template<typename T>

T op::Rectangle< T >::height

template<typename T>

T op::Rectangle< T >::width

template<typename T>

T op::Rectangle< T >::x

template<typename T>

T op::Rectangle< T >::y

The documentation for this struct was generated from the following file:

- /home/travis/build/CMU-Perceptual-Computing-Lab/openpose/include/openpose/core/rectangle.hpp