Examples
import { BoundingBox2D, intersectAABB2D } from '@wimaengine/geometry'
const a = new BoundingBox2D(0, 0, 2, 2)
const b = new BoundingBox2D(2, 1, 4, 3)
intersectAABB2D(a, b) // true: the boxes share an x edgeFunction
intersectAABB2D(a: BoundingBox2D, b: BoundingBox2D): booleanReturns whether two BoundingBox2D values overlap.
The x and y intervals are tested independently with inclusive comparisons.
Boxes that share an edge or corner therefore return true; boxes separated
on either axis return false. The helper reads the bounds without mutating
either value and does not validate or reorder their coordinates.
import { BoundingBox2D, intersectAABB2D } from '@wimaengine/geometry'
const a = new BoundingBox2D(0, 0, 2, 2)
const b = new BoundingBox2D(2, 1, 4, 3)
intersectAABB2D(a, b) // true: the boxes share an x edge