This project is part of the @thi.ng/umbrella monorepo.
Z-order-curve / Morton encoding & decoding for 1D, 2D, 3D.
- https://fgiesen.wordpress.com/2009/12/13/decoding-morton-codes/
- https://www.forceflow.be/2013/10/07/morton-encodingdecoding-through-bit-interleaving-implementations/
- https://github.com/JaneliaSciComp/Morton.jl/blob/master/src/Morton.jl
yarn add @thi.ng/morton
import * as m from "@thi.ng/morton";
m.mux2(23, 42);
// 2461
m.demux2(2461)
// [ 23, 42 ]
m.muxScaled2(0.25, 0.75)
// 2594876074
m.demuxScaled2(m.muxScaled2(0.25, 0.75))
// [ 0.2500038147554742, 0.7499961852445258 ]
- Karsten Schmidt
© 2015 - 2018 Karsten Schmidt // Apache Software License 2.0