pub fn hilbert_to_xy(d: u64, order: usize) -> (u32, u32)
Converts a 1D Hilbert index $d$ back to 2D grid coordinates $(x, y)$.