Axis-aligned 2D box, primarily for bounding. More...
#include <common.h>
Public Member Functions | |
constexpr | Rect () |
constexpr | Rect (const vec2 a, const vec2 b) |
Public Attributes | |
vec2 | min = vec2(std::numeric_limits<double>::infinity()) |
vec2 | max = vec2(-std::numeric_limits<double>::infinity()) |
Information | |
Details of the rectangle | |
constexpr vec2 | Size () const |
constexpr double | Area () const |
constexpr double | Scale () const |
constexpr vec2 | Center () const |
constexpr bool | Contains (const vec2 &p) const |
constexpr bool | Contains (const Rect &rect) const |
constexpr bool | DoesOverlap (const Rect &rect) const |
constexpr bool | IsEmpty () const |
constexpr bool | IsFinite () const |
Modification | |
void | Union (const vec2 p) |
constexpr Rect | Union (const Rect &rect) const |
constexpr Rect | operator+ (const vec2 shift) const |
Rect & | operator+= (const vec2 shift) |
constexpr Rect | operator* (const vec2 scale) const |
Rect & | operator*= (const vec2 scale) |
constexpr Rect | Transform (const mat2x3 &m) const |
Axis-aligned 2D box, primarily for bounding.
|
inlineconstexpr |
Default constructor is an empty rectangle..
Create a rectangle that contains the two given points.
|
inlineconstexpr |
Return the dimensions of the rectangle.
|
inlineconstexpr |
Return the area of the rectangle.
|
inlineconstexpr |
Returns the absolute-largest coordinate value of any contained point.
|
inlineconstexpr |
Returns the center point of the rectangle.
|
inlineconstexpr |
Does this rectangle contain (includes on border) the given point?
|
inlineconstexpr |
Does this rectangle contain (includes equal) the given rectangle?
|
inlineconstexpr |
Does this rectangle overlap the one given (including equality)?
|
inlineconstexpr |
Is the rectangle empty (containing no space)?
|
inlineconstexpr |
Does this recangle have finite bounds?
|
inline |
Expand this rectangle (in place) to include the given point.
Expand this rectangle to include the given Rect.