import { type AABB, type Hit, rayVsAABB, type Vec } from "./given.ts"; /** * A moving box `a` (velocity `v` over this frame) vs a static box `b`. * * Inflate `b` by `a`'s size (Minkowski sum), collapse `a` to its corner point, * then reuse rayVsAABB. Return its Hit, or null for no collision this frame. */ export function sweptAABB(a: AABB, v: Vec, b: AABB): Hit | null { const inflated: AABB = { x: b.x - a.w, y: b.y - a.h, w: b.w + a.w, h: b.h + a.h, }; const point: Vec = { x: a.x, y: a.y }; return rayVsAABB(point, v, inflated); }