Axis-Aligned Bounding Boxes
npm install aabb
TODO
min
the minimum coordinates of the AABB. In a 2-D AABB in screen space, the coordinates for the upper-left corner.
max
the maximum coordinates of the AABB. In a 2-D AABB in screen space, the coordinates for the lower-right corner.
Constructs a new AABB of dimensionality equal to min.length
using the specified bounds.
NOTE The number of elements in min
and max
(ie. the dimensions) must be the same.
axis
the zero-based array index representing a particular axis. By convention, 0 = x, 1 = y, 2 = z, and so on.
Returns the length of the AABB along the side defined by axis
.
Returns an array containing the lengths of all sides of the AABB.
Expand this
to contain otherAABB
.
elements
an array of elements.
startAt
offset into the elments
which to start at.
Expand this
to contain all elements
.
elements
an array of elements.
Return a new AABB that contains the bounds of all elements
.
Returns true
if this
and otherAABB
overlap each other.
Returns true
if this
completely contains otherAABB
.
Returns true
if this
is completely contained by otherAABB
.
Returns the surface area of the AABB. In the 2 dimension case, this is the AABB's perimeter.
Returns the volume of the AABB. In the 2 dimension case, this is the AABB's area.
Returns a clone of this
.
ray
a ray to test against.
Returns false
is no intersection is possible. Otherwise, returns the portion of the ray (a ray segment) that results from the intersection of the ray with the AABB.
rs
- a ray segment to test against.
Returns false
is no intersection is possible. Otherwise, returns the portion of the ray segment that results from the intersection of the ray segment with the AABB.