Skip to content

hilbert_encode

function hilbert_encode(point, size): number;

Defined in: hilbert.ts:32

Maps a grid cell to its position along the Hilbert curve.

ParameterTypeDescription
pointPointInteger grid cell, both components in [0, size).
sizenumberSide length of the grid; must be a power of two.

number

The curve index, in [0, size²).

If size is not a power of two, or is above HILBERT_MAX_LEVEL.