THE BOUNDING BOX the cheapest shape — min and max, and a fast rejection
The axis-aligned bounding box (AABB) is the humblest structure in geometry: the smallest upright rectangle containing a set of points, found by a single pass taking the min and max of each coordinate. Its power is rejection: two shapes cannot overlap if their boxes do not, and a point cannot be in a shape if it is outside the box — so a cheap box test culls the expensive exact test in collision detection, ray tracing, and spatial indexing. No cross products, no cleverness — four numbers that make everything else faster.
THE TECHNIQUE min/max of each coordinate — the smallest upright rectangle
The demo finds the bounding box of six points — the min and max x and y: live demo
HISTORY & CREDIT AABB · broad-phase rejection
“Collision tests are always expensive.” — a box test rejects the easy misses first, so the exact test runs rarely. cited
the box · [min x, max x] × [min y, max y] — one pass, no products. the rejection · disjoint boxes ⇒ disjoint shapes — cull before the exact test. the uses · collision broad-phase, ray-tracing BVH, spatial indexes — the cheap first filter.
Four numbers that wrap a cloud of points — the cheapest shape, and the fastest “no.” resource
RECOMMEND FOR I-13 the min/max box, on the compiler
On the canonical compiler, six points give the box x∈[1,9], y∈[1,8]:
$ i13 run cg_boundingbox.i13 # min/max of coordinates
RUN OK · 682 step(s) · peak stack 6 · call depth 7
minx = 1 maxx = 9
miny = 1 maxy = 8
box = 1
Recommend as a NULL — a min/max reduction. The bounding box is a fold (min and max) over coordinates — a computed summary whose value is pinned by the points (B39), used as a resource-saving pre-filter (B40). No new invariant. NULL — the cheapest shape, and the fast “no” that makes the exact tests affordable.