Skip to content

Empty-space function

For each of many random sample locations, the distance to the nearest data point — the spherical contact / F-function.

Where nearest-neighbour distance measures gaps between points, this measures the size of empty space. Large values mean big voids. It is the natural complement to ANNI: a clustered pattern leaves large empty regions (big empty-space distances); an evenly spread pattern fills the region (small ones).

The same brute-force min-distance kernel as nearest-neighbour distance, but queried from a separate set of random sample locations (and without excluding self). Authored in "use gpu". Sampling is seeded, so results are reproducible.

import { emptySpaceGpu } from 'intraspatial/gpu/spatial/emptySpace';
const r = await emptySpaceGpu(xs, ys, { numSamples: 1024, bbox: [0, 0, 100, 100] });
// r.distances: per-sample nearest-point distance; r.mean: typical void radius

The full distribution of r.distances is the empty-space CDF; its mean is a compact “typical void radius”.

Status: ✅ implemented and CPU-golden validated · src/gpu/spatial/emptySpace.ts