-
Notifications
You must be signed in to change notification settings - Fork 1
/
overview.edoc
45 lines (36 loc) · 1.44 KB
/
overview.edoc
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
@author Guilherme Andrade <erlzord(at)gandrade(dot)net>
@copyright 2017 Guilherme Andrade
@version 1.0.3
@title erlzord
@doc `erlzord': N-dimensional Z-order curves for Erlang
<hr/>
`erlzord' is a straightforward Erlang implementation of the <a href="https://en.wikipedia.org/wiki/Z-order_curve">Z-order curve</a> function.
* Any number of dimensions is supported
* No limit on the bitsize of output values
The code was successfully tested on generations 17, 18 and 19 of Erlang/OTP; the test cases and their data
were automatically generated based on an existing <a href="https://github.com/LLNL/rubik/blob/master/rubik/zorder.py">Python implementation</a>
from the <a href="https://github.com/LLNL/rubik">rubik</a> project.
== Examples ==
<pre lang="erlang">
% 1d points
Config = erlzord:config(1, 0, 100), % Coordinate values between 0 and 100
erlzord:encode({42}, Config), % 42
erlzord:decode(42, Config). % {42}
% 2d points
Config = erlzord:config(2, 0, 100),
erlzord:encode({50,0}, Config), % 1284
erlzord:decode(1284, Config). % {50,0}
% 3d points
Config = erlzord:config(3, 0, 100),
erlzord:encode({0,0,100}, Config), % 1179904
erlzord:decode(1179904, Config). % {0,0,100}
% 10d points
Config = erlzord:config(10, 0, 100),
erlzord:encode(
{100, 100, 100, 100, 100, 100, 100,
100, 100, 100}, Config), % 1180590494818577154048
erlzord:decode(
1180590494818577154048, Config). % {100,100,..,100}.
</pre>
== TODO ==
* Range searches