-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
30 lines (25 loc) · 722 Bytes
/
README
File metadata and controls
30 lines (25 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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.