Class: Rects
Defined in: math/rect.ts:16
Static operations on Rect, mirroring the Vector2/Vec2
convention.
Constructors
Constructor
new Rects():
Rects
Returns
Rects
Accessors
zero
Get Signature
get
staticzero():Rect
Defined in: math/rect.ts:21
A zero-size rect at the origin. A fresh instance is created on every access, so it's always safe to mutate.
Returns
Methods
clone()
staticclone(rect):Rect
Defined in: math/rect.ts:72
Creates a deep copy of a rect.
Parameters
rect
The rect to copy.
Returns
A new Rect with the same corner values.
contains()
staticcontains(rect,point):boolean
Defined in: math/rect.ts:43
Checks if a point is inside a rect, inclusive of its edges.
Parameters
rect
The rect to check.
point
The point to check.
Returns
boolean
True if the point is inside the rect, false otherwise.
intersects()
staticintersects(a,b):boolean
Defined in: math/rect.ts:58
Checks if two rects overlap, inclusive of touching edges/corners.
Parameters
a
The first rect.
b
The second rect.
Returns
boolean
True if the rects overlap, false otherwise.
size()
staticsize(rect):Vector2
Defined in: math/rect.ts:30
Calculates a rect's size.
Parameters
rect
The rect.
Returns
A new Vector2 holding max - min.