Function hilbert::transform::fast_hilbert::uninterleave[][src]

pub fn uninterleave(
    gray_code: &BigUint,
    bit_depth: usize,
    dimensions: usize,
    reverse_order: bool
) -> Vec<u32>
Notable traits for Vec<u8, A>
impl<A> Write for Vec<u8, A> where
    A: Allocator
Expand description

Spread the bits of the BigUint among coordinates for the given number of dimensions in a round-robin fashion, delaminating the big integer.

If reverse_order is true (the normal situation) then the first (lowest order) bit of the BigUint is assigned to the low-order bit position of the last dimension, the next bit is assigned to the low-bit of the previous dimension, etc, until the last bit is assigned to the high-order bit position of the first dimension. This is because unpack_big_integer returns the bits with the low-order bit first.

Example:

For 3 dimensions and 5 bits deep, the decimal number 25676 can be uninterleaved to the vector [17,24,6]. Here is how:

  • 0110010001001100 binary = 25676 in decimal
  • .1..0..0..0..1.. => 10001 = 17
  • ..1..1..0..0..0. => 11000 = 24
  • …0..0..1..1..0 => 00110 = 6

The high-order bit is a pad bit, because we only need 15 bits, and two bytes hold 16.