The formula on slide 26, one piece at a time, from the inside out. Next or → to step (steps 3 and 4 go one bit at a time); click on the grid to move the point.
Encode(p, b, g) = (b ≪ k)|φ−1(⌊p / g⌋)
click on the grid to move the point
Same thing in 3-D, as in PTv3
PTv3 does exactly this with three coordinates: the cell is (x, y, z), and Z-order interleaves three bits at a time, z y x, z y x, … Each group of three answers picks one of 8 sub-cubes instead of one of 4 quarters. So k = 3 × (bits per axis): a 10 m room at 2 cm is 500 cells per axis, 9 bits, so k = 27, and the batch index sits above bit 27. Hilbert's number is computed from the same bits with a slightly longer recipe (it rotates the quarters so the path never jumps); the batch index and the sort work the same way.