← Standard library

Rect

struct Rect
import 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.

Geometry2D.wax:8

Members

xfield

public float x

The minimum horizontal coordinate for nonnegative width.

Geometry2D.wax:12

yfield

public float y

The minimum vertical coordinate for nonnegative height.

Geometry2D.wax:16

widthfield

public float width

Horizontal extent; expected to be nonnegative.

Geometry2D.wax:20

heightfield

public float height

Vertical extent; expected to be nonnegative.

Geometry2D.wax:24

constructorconstructor

public constructor (float x, float y, float width, float height)

Stores the origin and size without validation or normalization.

Geometry2D.wax:29

FromMinMaxconstructor

public constructor FromMinMax (float2 min, float2 max)

Constructs from minimum and maximum corners. Supply ordered coordinates.

Geometry2D.wax:39

FromCenterSizeconstructor

public constructor FromCenterSize (float2 center, float2 size)

Constructs from a center and nonnegative size.

Geometry2D.wax:49

mingetter

public get min() : float2

The origin (x, y).

Geometry2D.wax:59

maxgetter

public get max() : float2

The opposite corner (x + width, y + height).

Geometry2D.wax:63

centergetter

public get center() : float2

The midpoint between min and max.

Geometry2D.wax:67

sizegetter

public get size() : float2

The stored width and height.

Geometry2D.wax:71

areagetter

public get area() : float

Returns width multiplied by height.

Geometry2D.wax:75

Containsmethod

public fn Contains(float2 point) : bool

Tests whether a point lies within the rectangle, including its boundary.

Geometry2D.wax:80

ContainsRectmethod

public fn ContainsRect(Rect other) : bool

Tests whether both bounds of another rectangle lie within this one, including equal edges.

Geometry2D.wax:88

Intersectsmethod

public fn Intersects(Rect other) : bool

Tests strict overlap on both axes. Rectangles that only touch at an edge or corner return false.

Geometry2D.wax:97

Intersectionmethod

public fn Intersection(Rect other) : Rect

Returns the overlap bounds, clamping each disjoint extent to zero. The result may have zero width or height.

Geometry2D.wax:106

Unionmethod

public fn Union(Rect other) : Rect

Returns the smallest axis-aligned rectangle containing both rectangles.

Geometry2D.wax:119

Expandmethod

public fn Expand(float amount) : Rect

Returns a rectangle expanded by amount on every side. Negative amounts shrink; the result is not clamped to nonnegative size.

Geometry2D.wax:131

ToStringmethod

public fn ToString() : string

Provided by the compiler.

ToStringBuffermethod

public fn ToStringBuffer(StringBuilder builder) : int32

Provided by the compiler.