API Docs for: 0.7.1
Show:

AABB Class

Axis aligned bounding box class.

Constructor

AABB

(
  • [options]
)

Parameters:

  • [options] Object optional
    • [upperBound] Array optional
    • [lowerBound] Array optional

Methods

containsPoint

(
  • point
)
Boolean

Parameters:

  • point Array

Returns:

Boolean:

copy

(
  • aabb
)

Copy bounds from an AABB to this AABB

Parameters:

extend

(
  • aabb
)

Extend this AABB so that it covers the given AABB too.

Parameters:

overlaps

(
  • aabb
)
Boolean

Returns true if the given AABB overlaps this AABB.

Parameters:

Returns:

Boolean:

overlapsRay

(
  • ray
)
Number

Check if the AABB is hit by a ray.

Parameters:

Returns:

Number:

-1 if no hit, a number between 0 and 1 if hit.

setFromPoints

(
  • points
  • position
  • angle
  • skinSize
)

Set the AABB bounds from a set of points, transformed by the given position and angle.

Parameters:

  • points Array

    An array of vec2's.

  • position Array
  • angle Number
  • skinSize Number

    Some margin to be added to the AABB.

Properties

lowerBound

Array

The lower bound of the bounding box.

upperBound

Array

The upper bound of the bounding box.