pub fn hilbert_d2xy(n: u32, d: u32) -> (u32, u32)
Map a 1D index to a 2D Hilbert curve coordinate (order n)