A four-coordinate type [x, y, width, height]. Full reference Rect.
[x, y, width, height]
const beastPen: Rectangle = [20, 25, 40, 50]; Copy
const beastPen: Rectangle = [20, 25, 40, 50];
const beastPen: Rectangle = Rect.setCenter( [0, 0, ...penSize], beastPos); Copy
const beastPen: Rectangle = Rect.setCenter( [0, 0, ...penSize], beastPos);
[x, y, w, h] = beastPen; Copy
[x, y, w, h] = beastPen;
const penPos = Rect.position(beastPen);const penSize = Rect.size(beastPen); Copy
const penPos = Rect.position(beastPen);const penSize = Rect.size(beastPen);
const isInPen = Rect.containsPoint( beastPen, beast.pos,) Copy
const isInPen = Rect.containsPoint( beastPen, beast.pos,)
beast.pos = Rect.clampPoint(beast.pos, beastPen) Copy
beast.pos = Rect.clampPoint(beast.pos, beastPen)
A four-coordinate type
[x, y, width, height]. Full reference Rect.Examples
Construct a rectangle
Construct around a center point and size
Deconstruct a rect
Deconstruct into points
Check if beast is in his pen
Put the beast back in his pen