AABB

Class representing an AABB.

Constructor

new AABB(x, y, width, height)

Create an AABB using centre position, width, and height.

Parameters:
NameTypeDescription
x*

The x value of the centre.

y*

The y value of the centre.

width*

The width measured from the centre.

height*

The height measured from the centre.

Classes

AABB

Methods

contains(point) → {boolean}

Check if this AABB contains a Vector.

Parameters:
NameTypeDescription
pointVector

The vector to check.

Returns:
Type: 
boolean

intersects(range) → {boolean}

Check if this aabb intersects another AABB.

Parameters:
NameTypeDescription
rangeAABB

The target AABB to check.

Returns:
Type: 
boolean

lines() → {Array.<Line>}

Create an array of Lines containing a line for each side of the AABB.

Returns:
  • An array of Lines that can be added to a Plot using Plot#add.
Type: 
Array.<Line>

(static) fromCorners(topLeft, topRight, bottomRight, bottomLeft) → {AABB}

Create an AABB from four corner Vectors.

Parameters:
NameTypeDescription
topLeftVector
topRightVector
bottomRightVector
bottomLeftVector
Returns:
  • A new AABB object.
Type: 
AABB