gosper_encode
function gosper_encode( point, level, size, orientation?): number;Defined in: gosper.ts:171
Maps a point to its position along the Gosper curve.
The island is centred on the origin, so translate your data there first.
Points outside it return -1 rather than aliasing onto an interior cell.
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
point | Point | undefined | The point to index. |
level | number | undefined | Curve level; the curve has 7^level cells. |
size | number | undefined | Level-0 hexagon size, from gosper_size. |
orientation | HexOrientation | "flat" | Which way up the hexagons sit. Defaults to "flat". |
Returns
Section titled “Returns”number
The curve index in [0, 7^level), or -1 if outside the island.