![]() |
IDS peak genericC++ v1.12.0
|
A generic rectangle defined by a point and a size. More...
#include <peak_common/types/geometry/peak_common_rectangle.hpp>
Public Member Functions | |
| constexpr | RectangleT ()=default |
| Default constructor for RectangleT. | |
| constexpr | RectangleT (const PointT< PointType > &point, const SizeT< SizeType > &size) |
| Constructs a rectangle from a point and a size. | |
| constexpr | RectangleT (PointType x, PointType y, SizeType width, SizeType height) |
| Constructs a rectangle from coordinates and dimensions. | |
| PEAK_COMMON_NO_DISCARD constexpr PointType | GetX () const |
| Returns the x-coordinate of the rectangle's top-left corner. | |
| PEAK_COMMON_NO_DISCARD constexpr PointType | GetY () const |
| Returns the y-coordinate of the rectangle's top-left corner. | |
| PEAK_COMMON_NO_DISCARD constexpr SizeType | GetWidth () const |
| Returns the width of the rectangle. | |
| PEAK_COMMON_NO_DISCARD constexpr SizeType | GetHeight () const |
| Returns the height of the rectangle. | |
| PEAK_COMMON_NO_DISCARD constexpr SizeT< SizeType > | GetSize () const |
| Returns the size of the rectangle. | |
| PEAK_COMMON_NO_DISCARD constexpr PointT< PointType > | GetPosition () const |
| Returns the top-left corner of the rectangle as a Point. | |
| template<typename RhsPointType, typename RhsSizeType> | |
| constexpr bool | operator== (const RectangleT< RhsPointType, RhsSizeType > &rhs) const |
| Equality operator. | |
| template<typename RhsPointType, typename RhsSizeType> | |
| constexpr bool | operator!= (const RectangleT< RhsPointType, RhsSizeType > &rhs) const |
| Inequality operator. | |
| PEAK_COMMON_NO_DISCARD std::string | ToString () const |
| Returns a string representation of the rectangle. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, RectangleT rectangle) |
| Stream output operator for RectangleT. | |
A generic rectangle defined by a point and a size.
Represents a rectangle composed of a position (top-left corner) and a size. The position and size types are customizable via template parameters.
| PointType | The type representing the positions' coordinates (e.g., int32_t, float). |
| SizeType | The type representing the size's dimensions (e.g., uint32_t, float). |
|
constexprdefault |
Default constructor for RectangleT.
Constructs an empty rectangle with default-initialized point and size.
|
inlineconstexpr |
Constructs a rectangle from a point and a size.
| point | The top-left corner of the rectangle. |
| size | The dimensions of the rectangle. |
|
inlineconstexpr |
Constructs a rectangle from coordinates and dimensions.
| x | The x-coordinate of the top-left corner. |
| y | The y-coordinate of the top-left corner. |
| width | The width of the rectangle. |
| height | The height of the rectangle. |
|
inlineconstexpr |
Returns the height of the rectangle.
|
inlineconstexpr |
Returns the top-left corner of the rectangle as a Point.
|
inlineconstexpr |
Returns the size of the rectangle.
|
inlineconstexpr |
Returns the width of the rectangle.
|
inlineconstexpr |
Returns the x-coordinate of the rectangle's top-left corner.
|
inlineconstexpr |
Returns the y-coordinate of the rectangle's top-left corner.
|
inlineconstexpr |
Inequality operator.
Returns true if the rectangles are not equal.
| rhs | The RectangleT object to compare against. |
|
inlineconstexpr |
Equality operator.
Compares position and size for equality.
| rhs | The RectangleT object to compare against. |
|
inline |
Returns a string representation of the rectangle.
The output format is: { point: ..., size: ... }.
|
friend |
Stream output operator for RectangleT.
Outputs the rectangle in the format: { point: ..., size: ... }.
| os | The output stream. |
| rectangle | The rectangle to print. |