The lower bound of the bounding box.
The upper bound of the bounding box.
Whether the AABB contains a given point
Copy bounds from an AABB to this AABB
Extend this AABB so that it covers the given AABB too.
Returns true if the given AABB overlaps this AABB.
Check if the AABB is hit by a ray.
-1 if no hit, a number between 0 and 1 if hit, indicating the position between the "from" and "to" points.
var aabb = new AABB({
upperBound: [1, 1],
lowerBound: [-1, -1]
});
var ray = new Ray({
from: [-2, 0],
to: [0, 0]
});
var fraction = aabb.overlapsRay(ray); // fraction == 0.5
Axis aligned bounding box class
Example