-
Notifications
You must be signed in to change notification settings - Fork 0
Simple python module to calculate morton indices via intrinsics.
License
hirschsn/python-morton
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Prerequisites:
CPU supporting BMI2. Check using:
$ grep bmi2 /proc/cpuinfo
Build using:
python setup.py build_ext [--inplace]
Sample usage:
$ python
>>> import morton
>>> morton.xy2d(3, 2)
13
>>> morton.d2xy(13)
(3, 2)
>>> morton.d2xyz(13)
(3, 0, 1)
>>> morton.xyz2d(3, 0, 1)
13
Internal data handling:
Coordinates are ordered as (x, y) in 2D and (x, y, z) in 3D.
Those Coordinates are mapped to an internal Morton-ordering of
... y2 y1 y0 in 2D
x2 x1 x0
... z2 z1 z0 in 3D
y2 y1 y0
x2 x1 x0,
where xi, yi and zi are the i-th lowest bits of x, y and z.
About
Simple python module to calculate morton indices via intrinsics.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published