Function morton_encoding::morton_decode [−][src]
pub fn morton_decode<Coordinate, const N: usize>(
input: <Coordinate as IdealKey<N>>::Key
) -> [Coordinate; N] where
Coordinate: IdealKey<N> + ToPrimitive + PrimInt,
<Coordinate as IdealKey<N>>::Key: ValidKey<Coordinate>,
The most ergonomic way to perform the Morton decoding operation.
Works for all primitive unsigned integers, and never panics for them.
Will work for others if the user implements the IdealKey
trait for them, but will panic if the trait is misimplemented.
Examples
let input = 992; let output: [u8; 5] = morton_decode(input); assert_eq!(output, [2u8; 5]); let input = [543u32, 23765]; let encoded_input: u64 = morton_encode(input); let reassembled_input: [u32; 2] = morton_decode(encoded_input); assert_eq!(input, reassembled_input);