Optionalx: numberOptionaly: numberOptionalwidth: numberOptionalheight: numberOptionalonOptional change hook invoked at the end of every mutator. Engine-internal: owners install it, user code normally leaves it unset. It is intentionally not copied by Rectangle2.copy or Rectangle2.clone — the hook belongs to the owner of the instance, not to the value.
Allocates a new rectangle with the same components. The clone has no change hook. This is the only allocating method on the type (§7b).
Whether the point lies inside this rectangle, half-open on both axes:
the x/y edge is inside, the x + width / y + height edge is out.
Half-open is what makes adjacent rectangles partition a space with no
point in two of them — the texel-region semantics §61's first consumer
needs. Does not mutate; an empty rectangle contains nothing.
Copies the components of r into this rectangle. The change hook is not copied.
Component-wise approximate equality: true when every component differs by
at most epsilon (absolute tolerance).
Optionalepsilon: numberWhether this rectangle covers no area — a non-positive width or
height. Does not mutate.
Sets all four components.
Mutable axis-aligned rectangle (§7b) —
x/yis one corner,widthandheightextend it along the two axes.Which corner
x/ynames is deliberately not decided here: a rectangle is four numbers, and the space it measures belongs to the API that takes it. §61'sreadPixels(target, region)— the first consumer, and the reason this type exists (RFC 0005's recorded prerequisite) — readsx/yas the region's bottom-left corner in target texels, matching the §7a Y-up bottom-to-top row order its result is defined in; §55's spriteframewill document its own atlas convention when it lands. Each consumer states its origin, exactly asViewportdocuments its own rectangle.Validation posture (§85, per the family): none. Like
Vector2, this type stores what it is given — negative or fractional extents included — and the API that consumes a rectangle enforces its own §85 constraints (a readback region must be integral and inside the target; a UV frame need not be).Allocation policy (§7b, plan D7): instance methods that produce a "this-shaped" result mutate in place and return
this; only Rectangle2.clone allocates. Scalar queries (containsPoint,isEmpty) andequalsApproxnever allocate and never mutate.Change notification (plan D3): every mutator invokes Rectangle2.onChanged after writing. Direct field writes (
r.width = 8) bypass the hook by design and require an explicitmarkDirty()on the owner.