Skip to main content

BoundingBox

BoundingBox

A simple axis-aligned bounding box. A representation of a 2D Bounding Box. Used to keep track of area used by component(s).


Constructor

public BoundingBox

new BoundingBox(min, max)

Creates a Bounding Box with the given coordinates.

Parameters

  •  min: Vector – The corrdinates of bottom left corner of Bounding Box.

  •  max: Vector – The coordinates of top right corner of Bounding Box.


Properties

No publicly accessible properties on BoundingBox

private min: Vector

Description needed

private max: Vector

Description needed


Methods

public getMin

getMin() => Vector

Returns the (x,y) value of bottom left corner of Bounding Box.

Returns

  •   Vector – Coordinates of bottom left corner of Bounding Box.

public getMax

getMax() => Vector

Returns the (x,y) value of top right corner of Bounding Box.

Returns

  •   Vector – Coordinates of top right corner of Bounding Box.

public setMin

setMin(min) => void

Sets new coordinates for bottom left corner of Bounding Box.

Parameters

  •  min: Vector – Coordinates of new bottom left corner of Bounding Box.

public setMax

setMax(max) => void

Sets new corrdinates for top right corner of Bounding Box.

Parameters

  •  max: Vector – Coordinates of new top right corner of Bounding Box.

public getWidth

getWidth() => number

Calculates coordinate length of the width of Bounding Box.

Returns

  •   number – Coordinate length of the width of Bounding Box.

public getHeight

getHeight() => number

Calculates coordinate length of the height of Bounding Box.

Returns

  •   number – Coordinate length of the height of Bounding Box.

public getArea

getArea() => number

Calculates coordinate area of Bounding Box.

Returns

  •   number – Coordinate area of Bounding Box.

public getCenter

getCenter() => Vector

Calculates the coordinates of the center of Bounding Box.

Returns

  •   Vector – Coordinates of the center of Bounding Box.

Static Methods

No static methods for BoundingBox