|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Implementation of the 3D Hilbert space-filling curve. More...
#include <EBGeometry_SFC.hpp>
Static Public Member Functions | |
| static uint64_t | encode (const Index &a_point) noexcept |
| Encode the input point into the linear Hilbert distance. | |
| static Index | decode (const uint64_t &a_code) noexcept |
| Decode the linear Hilbert distance back into an Index. | |
Implementation of the 3D Hilbert space-filling curve.
Uses Skilling's algorithm (J. Skilling, "Programming the Hilbert curve", AIP Conf. Proc. 707, 381 (2004)): encode() maps the 3D grid index into the Hilbert "transpose" representation and bit-interleaves it into the linear Hilbert distance; decode() reverses both steps. Unlike Morton (Z-order), the Hilbert curve has no long-range jumps – consecutive codes always map to spatially adjacent cells (Manhattan distance 1) – so an ordering along it produces more compact, better localized runs of primitives, which is why it is often preferred for building spatially coherent leaves. Encodes/decodes the same [0, ValidSpan] per-axis range as Morton and Nested, using the full 3*ValidBits = 63 bits of the code.