Skip to content

Engine → Core → rect.h

urect

Syntax

struct urect

Variables

AccessNameTypeDefaultDescription
publicheightu320
publicwidthu320
publicxu320
publicyu320

Functions

Public

area

[[nodiscard]] u64 area() const noexcept;

Number of covered pixels.

bottom

[[nodiscard]] u32 bottom() const noexcept;

One past the last covered row. Asserts when y + height overflows u32.

contains

[[nodiscard]] bool contains(
    u32 pixelX,
    u32 pixelY) const noexcept;

True when the pixel at (pixelX, pixelY) is covered.

[[nodiscard]] bool contains(
    const urect &other) const noexcept;

True when every pixel of other is covered by this rectangle (an empty other is contained when its origin is inside or on the edge).

intersection

[[nodiscard]] urect intersection(
    const urect &other) const noexcept;

The pixels covered by both rectangles; empty (zero size at the clamped origin) when they do not intersect.

intersects

[[nodiscard]] bool intersects(
    const urect &other) const noexcept;

True when both rectangles cover at least one common pixel.

is_empty

[[nodiscard]] bool is_empty() const noexcept;

True when the rectangle covers no pixel.

right

[[nodiscard]] u32 right() const noexcept;

One past the last covered column. Asserts when x + width overflows u32.

to_rect

[[nodiscard]] rect to_rect() const noexcept;

The same region as a float rectangle (min = origin, max = origin + size).

Operator Overloads

Public

operator==

[[nodiscard]] bool operator==(
    const urect &other) const = default;