59 bool operator==(const
CellSize &other) const noexcept = default;
106 [[nodiscard]] std::int32_t
right() const noexcept;
110 [[nodiscard]] std::int32_t
bottom() const noexcept;
114 [[nodiscard]]
bool empty() const noexcept;
150 bool operator==(const
CellRect &other) const noexcept = default;
CellPoint origin() const noexcept
Return the cell origin by value; no errors.
bool contains(CellPoint point) const noexcept
Test half-open point membership; an empty rectangle contains no point.
CellRect() noexcept=default
Create the empty rectangle at (0, 0); no errors.
bool empty() const noexcept
Whether either extent is zero; no errors.
std::expected< CellRect, GeometryError > translated(CellPoint offset) const noexcept
Return an owning translated rectangle, preserving its extents.
CellSize size() const noexcept
Return the normalized cell extents by value; no errors.
CellRect intersection(CellRect clip) const noexcept
Intersect with a clipping rectangle; no errors or invalidation.
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.
static std::expected< CellRect, GeometryError > from(CellPoint origin, CellSize available) noexcept
Create a rectangle after normalizing negative available extents to zero.
Public Portals API.
Definition action.hpp:8
std::expected< CellPoint, GeometryError > translated(CellPoint point, CellPoint offset) noexcept
Translate a cell point by an explicit columns/rows offset.
GeometryError
Failure of a checked cell-coordinate operation.
Definition geometry.hpp:12
@ COORDINATE_OVERFLOW
An origin or exclusive end would be outside the int32_t range.
Definition geometry.hpp:14
An owning value in terminal columns/rows, x right and y down.
Definition geometry.hpp:24
std::int32_t y
Vertical coordinate in terminal rows.
Definition geometry.hpp:28
std::int32_t x
Horizontal coordinate in terminal columns.
Definition geometry.hpp:26
bool operator==(const CellPoint &other) const noexcept=default
Compare both coordinates; no errors or invalidation.
An owning available extent in terminal columns/rows.
Definition geometry.hpp:44
CellSize normalized() const noexcept
Return an owning nonnegative extent; no errors or invalidation.
std::int32_t height
Available number of rows, possibly negative before normalization.
Definition geometry.hpp:48
std::int32_t width
Available number of columns, possibly negative before normalization.
Definition geometry.hpp:46