rect¶
| Type | Struct |
| Namespace | conjure::math |
| Include File Path | engine/include/conjure/core/math/rect.h |
| Source File Path | N/A |
| API ↗ | Math |
Syntax¶
Variables¶
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| public | max | vec2 | vec2(0.0f) | |
| public | min | vec2 | vec2(0.0f) |
Functions¶
Public¶
closest_point¶
closest_point¶The point inside or on the rectangle nearest to point (point itself when inside). An invalid rectangle has no surface and returns point unchanged.
contains¶
contains¶[[nodiscard]] bool contains(
vec2 point) const noexcept;True when the point lies inside or on the rectangle.
[[nodiscard]] bool contains(
const rect &other) const noexcept;True when other lies entirely inside or on this rectangle (false when either is invalid).
expand¶
expand¶void expand(
vec2 point) noexcept;Grows the rectangle to include a point.
void expand(
const rect &other) noexcept;Grows the rectangle to include another (an invalid other is ignored).
from_center_extents¶
from_center_extents¶A rectangle from its centre and half-size on each axis (negative extents are made positive).
from_points¶
from_points¶A rectangle from two arbitrary corners.
from_position_size¶
from_position_size¶The rectangle spanned by position and position + extent; a negative extent component extends to the other side of position (from_position_size((10, 10), (-4, 2)) is min (6, 10), max (10, 12)).
inflated¶
inflated¶A copy grown by amount on every side (shrunk for negative amounts).
intersection¶
intersection¶The overlap of both rectangles; invalid when they do not intersect.
intersects¶
intersects¶[[nodiscard]] bool intersects(
const rect &other) const noexcept;True when the rectangles overlap or touch (false when either is invalid).
is_empty¶
is_empty¶[[nodiscard]] bool is_empty() const noexcept;True when the rectangle has no area (invalid or zero width or height).
is_valid¶
is_valid¶[[nodiscard]] bool is_valid() const noexcept;True when min <= max on both axes (an empty rectangle is valid).