Rect
struct Rectimport Rect from Wax;An axis-aligned rectangle stored as an origin and size. Supply finite coordinates and nonnegative width/height; constructors do not reorder or validate them. Point containment includes edges, while rectangle intersection uses strict overlap comparisons.
Members
xfield
public float xThe minimum horizontal coordinate for nonnegative width.
yfield
public float yThe minimum vertical coordinate for nonnegative height.
widthfield
public float widthHorizontal extent; expected to be nonnegative.
heightfield
public float heightVertical extent; expected to be nonnegative.
constructorconstructor
public constructor (float x, float y, float width, float height)Stores the origin and size without validation or normalization.
FromMinMaxconstructor
public constructor FromMinMax (float2 min, float2 max)Constructs from minimum and maximum corners. Supply ordered coordinates.
FromCenterSizeconstructor
public constructor FromCenterSize (float2 center, float2 size)Constructs from a center and nonnegative size.
mingetter
public get min() : float2The origin (x, y).
maxgetter
public get max() : float2The opposite corner (x + width, y + height).
centergetter
public get center() : float2The midpoint between min and max.
sizegetter
public get size() : float2The stored width and height.
areagetter
public get area() : floatReturns width multiplied by height.
Containsmethod
public fn Contains(float2 point) : boolTests whether a point lies within the rectangle, including its boundary.
ContainsRectmethod
public fn ContainsRect(Rect other) : boolTests whether both bounds of another rectangle lie within this one, including equal edges.
Intersectsmethod
public fn Intersects(Rect other) : boolTests strict overlap on both axes. Rectangles that only touch at an edge or corner return false.
Intersectionmethod
public fn Intersection(Rect other) : RectReturns the overlap bounds, clamping each disjoint extent to zero. The result may have zero width or height.
Unionmethod
public fn Union(Rect other) : RectReturns the smallest axis-aligned rectangle containing both rectangles.
Expandmethod
public fn Expand(float amount) : RectReturns a rectangle expanded by amount on every side. Negative amounts shrink; the result is not clamped to nonnegative size.
ToStringmethod
public fn ToString() : stringProvided by the compiler.
ToStringBuffermethod
public fn ToStringBuffer(StringBuilder builder) : int32Provided by the compiler.