Skip to content

Efficient Pythonic Implementation of 3D Morton Encoding and Decoding.

License

Notifications You must be signed in to change notification settings

Jianningli/Morton3D

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Morton3D (Homepage)

Efficient pythonic implementation of 3D Morton encoding and decoing.

Similar python packages on Github: pymorton, morton-py, pyzorder

Installation

pip install:

pip install Morton3D==1.0.1

install from source:

git clone https://github.com/Jianningli/Morton3D
cd Morton3D
python setup.py install

Usage

import Morton3D
m=Morton3D.zorder(9) # 9 is the bit length
mortonValue,mortonBinary=m.Morton(51,20,50) # encoding, (51,20,50) is the 3D integer coordinate.
coordinate=m.deMorton(192681,0) # decoding, given the mortonValue, return the 3D coordinate
# decoding, given the morton value in bit representation, return the 3D coordinate, 1 is the flag.
coordinate=m.deMorton('000000000101111000010101001',1)