Skip to content

Simple python module to calculate morton indices via intrinsics.

License

Notifications You must be signed in to change notification settings

hirschsn/python-morton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

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