Skip to main content

Module hilbert

Module hilbert 

Source
Expand description

2D Hilbert Space-Filling Curve Mapping.

Maps 2D spatial coordinates $(x, y)$ to a 1D scalar index $d$ and vice-versa, preserving spatial proximity for memory-mapped chunk caching and GPU spatial lookups.

Functionsยง

hilbert_to_xy
Converts a 1D Hilbert index $d$ back to 2D grid coordinates $(x, y)$.
xy_to_hilbert
Converts 2D grid coordinates $(x, y)$ to a 1D Hilbert index $d$.