Skip to main content

hilbert_d2

Function hilbert_d2 

Source
pub fn hilbert_d2(x: u32, y: u32, order: u32) -> u64
Expand description

Map 2D integer coordinates to a 1D Hilbert index.

order is the number of recursion levels. Both x and y must be less than 2^order. The returned index is in [0, 2^(2*order)).

ยงExamples

use scirs2_spatial::hilbert::hilbert_d2;
let idx = hilbert_d2(0, 0, 4);
assert_eq!(idx, 0);