|
Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
|
An owning, invariant-preserving half-open cell rectangle. More...
#include <geometry.hpp>
Public Member Functions | |
| CellRect () noexcept=default | |
| Create the empty rectangle at (0, 0); no errors. | |
| CellPoint | origin () const noexcept |
| Return the cell origin by value; no errors. | |
| CellSize | size () const noexcept |
| Return the normalized cell extents by value; no errors. | |
| std::int32_t | right () const noexcept |
| Return the representable exclusive horizontal end; no errors. | |
| std::int32_t | bottom () const noexcept |
| Return the representable exclusive vertical end; no errors. | |
| bool | empty () const noexcept |
| Whether either extent is zero; no errors. | |
| bool | contains (CellPoint point) const noexcept |
| Test half-open point membership; an empty rectangle contains no point. | |
| bool | contains (CellRect rect) const noexcept |
| Test cell-set inclusion; every empty rectangle is a subset of every rectangle. | |
| CellRect | intersection (CellRect clip) const noexcept |
| Intersect with a clipping rectangle; no errors or invalidation. | |
| std::expected< CellRect, GeometryError > | translated (CellPoint offset) const noexcept |
| Return an owning translated rectangle, preserving its extents. | |
| bool | operator== (const CellRect &other) const noexcept=default |
| Compare origin and extents, including the position of empty rectangles. | |
Static Public Member Functions | |
| static std::expected< CellRect, GeometryError > | from (CellPoint origin, CellSize available) noexcept |
| Create a rectangle after normalizing negative available extents to zero. | |
An owning, invariant-preserving half-open cell rectangle.
The covered cells are [x, right()) x [y, bottom()). Extents are nonnegative; origin and exclusive ends fit int32_t. A zero extent on either axis is empty. All results own their data. No references are borrowed, no allocation occurs, and no implicit Canvas/GUI conversion exists. Values are thread-agnostic; concurrent reads are safe and shared assignment requires synchronization. Operations do not invalidate any values or trigger layout/paint invalidation.
|
nodiscardnoexcept |
Return the representable exclusive vertical end; no errors.
|
nodiscardnoexcept |
Test half-open point membership; an empty rectangle contains no point.
| point | Cell coordinate tested against the half-open bounds. |
|
nodiscardnoexcept |
Test cell-set inclusion; every empty rectangle is a subset of every rectangle.
| rect | Rectangle whose covered cell set is tested. |
|
nodiscardnoexcept |
Whether either extent is zero; no errors.
|
staticnodiscardnoexcept |
Create a rectangle after normalizing negative available extents to zero.
| origin | Signed cell origin, copied without borrowing storage. |
| available | Signed available cell extents, copied and normalized. |
Intersect with a clipping rectangle; no errors or invalidation.
| clip | Owning-value clipping bounds, copied without borrowing storage. |
Each disjoint/touching axis has zero extent, independently of the other axis. Empty results retain that deterministic origin and the other axis's overlap; their position does not imply point membership. No unchecked subtraction occurs.
|
defaultnoexcept |
Compare origin and extents, including the position of empty rectangles.
| other | Value whose corresponding fields are compared. |
|
nodiscardnoexcept |
Return the cell origin by value; no errors.
|
nodiscardnoexcept |
Return the representable exclusive horizontal end; no errors.
|
nodiscardnoexcept |
Return the normalized cell extents by value; no errors.
|
nodiscardnoexcept |
Return an owning translated rectangle, preserving its extents.
| offset | Signed cell displacement, copied without borrowing storage. |