A rectangle. More...
#include <Rect.hpp>
Public Member Functions | |
constexpr | Rect (const sp::Vec< T, 2 > &position, const sp::Vec< T, 2 > size) |
Construct a rectangle given size and position. More... | |
constexpr sp::Vec< T, 2 > | topLeft () const |
Get the top-left corner. More... | |
constexpr sp::Vec< T, 2 > | topRight () const |
Get the top-right corner. More... | |
constexpr sp::Vec< T, 2 > | bottomLeft () const |
Get the bottom-left corner. More... | |
constexpr sp::Vec< T, 2 > | bottomRight () const |
Get the bottom-right corner. More... | |
constexpr bool | valid () const |
Does this rectangle actually make sense? More... | |
constexpr sp::Rect< T > | intersect (const sp::Rect< T > &other) |
Get a new rectangle representing the intersection of this one with other . More... | |
constexpr sp::Rect< T > | boundingRect (const sp::Rect< T > &other) const |
Find the smallest rectangle that contains (as defined in contains() ) both this rectangle and the given one. More... | |
constexpr bool | contains (const sp::Vec< T, 2 > &point) |
Does this rectangle contain the given point? More... | |
constexpr bool | contains (const sp::Rect< T > &rect) |
Does this rectangle contain the given rectangle? More... | |
bool | operator== (const sp::Rect< T > &other) const |
bool | operator!= (const Rect< T > &other) const |
Static Public Member Functions | |
constexpr static Rect< T > | fromPoints (const sp::Vec< T, 2 > &topLeft, const sp::Vec< T, 2 > &bottomRight) |
Create a rectangle given its top-left and bottom-right corners. More... | |
Public Attributes | |
sp::Vec< T, 2 > | position |
sp::Vec< T, 2 > | size |
A rectangle.
T | The type used to store the elements of the rectangle. |
|
constexpr |
Construct a rectangle given size and position.
Get the bottom-left corner.
Get the bottom-right corner.
|
constexpr |
Find the smallest rectangle that contains (as defined in contains()
) both this rectangle and the given one.
|
constexpr |
Does this rectangle contain the given rectangle?
If the given rectangle touches the edge of this one, but is otherwise inside it (including if it is equal to this one), then true is returned.
|
constexpr |
Does this rectangle contain the given point?
Points exactly on the border of the rectangle are considered to be inside it.
|
staticconstexpr |
Create a rectangle given its top-left and bottom-right corners.
|
constexpr |
Get the top-left corner.
Get the top-right corner.
|
constexpr |
Does this rectangle actually make sense?