Skip to content

rectint

geometry · scripts/geometry/rectint.m

: area = rectint (a, b)

Return the overlap area of axis-aligned rectangles.

Each row of a (n-by-4) and b (m-by-4) is a rectangle [x, y, width, height]; area(i,j) is the area of the intersection of the i-th rectangle of a with the j-th of b. Rectangles that merely touch, or have a negative extent, give zero.

As an extension, 2*d columns describe d-dimensional boxes [x1..xd, w1..wd] and the result is the overlap volume.