@fogrexon/glyph-arena-collide

Axis-aligned bounding box overlap test. See also package README.

Exports

Generated from the package's source when the docs are built — do not edit this table by hand.

NameKind
Aabbtype
overlapsfunction

overlaps(a, b)

const hit = overlaps(
  { x: 0, y: 0, width: 10, height: 10 },
  { x: 5, y: 5, width: 10, height: 10 },
);

Returns true when two AABBs overlap or touch on an edge. Returns false when boxes are separate.

Aabb

FieldTypeDescription
xnumberleft edge
ynumbertop edge
widthnumberbox width
heightnumberbox height

Invalid boxes

Returns false when either box has non-positive width or height, or any field is non-finite (NaN, Infinity).

Inputs are not mutated.