Skip to main content

intersect-boxes

function intersectBoxes(a: number[][], b: number[][]): number[][] | undefined

Defined in boxes/intersect-boxes.ts:18

Returns the intersection of 2 given axis-aligned rectangular boxes (or undefined if they don't intersect).

  • exact: not susceptible to floating point round-off
  • closed: interpret boxes as being closed (i.e. they contain their border).
Note!
Green circles are draggable!
0

Parameters:

NameTypeDescription
anumber[][]an axis-aligned rectangular box (given by an array of two points, e.g. [[1,2], [3,4]])
bnumber[][]another box