Utilities (mapping, unmapping, calculating enclosing polygon) for space filling curves (currently only Hilbert). Future plans include minimizing the enclosing polygon, calculating centroids, and supporting more curves like Peano.
Examples:
Map 31 from the 1-dimension domain [0,64) to x,y in [0,16):
>>> from sfcurves import hilbert
>>> hilbert.forward(31, 64)
(3, 4)
Reverse map (3,4) to the 1-dimension [0,64):
>>> hilbert.reverse(3, 4, 64)
31
If you're mapping the entire domain, then using the generator is considerably faster:
>>> g = hilbert.generator(64)
>>> next(g)
(0, 0)
>>> next(g)
(0, 1)
Calculate an enclosing polygon for the mapped points 0 thru 6 in the 1-dimension domain [0,64)
>>> hilbert.outline(0, 6, 64)
[(0, 0), (1, 0), (2, 0), (3, 0), (3, 1), (3, 0), (2, 0), (1, 0), (1, 1), (0, 1)]
Metadata
Release files for sfcurves 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sfcurves-1.0.0.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sfcurves-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / sfcurves-1.0.0.tar.gz
| Download URL | sfcurves-1.0.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6fed7f057e836bb6743a4559f71edd2ce95d0d2c206c99f936d129ff4410695
|
|
BLAKE2b-256 checksum How to use checksums |
8b4caa765532d512c9d0d092752be97457bf822d52e6e70add50d4976e845df1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.4
|
Release files / sfcurves-1.0.0-py3-none-any.whl
| Download URL | sfcurves-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed76e1db6342286fa93931f57c98fdbd4c7654c1148d56d562872128ea830061
|
|
BLAKE2b-256 checksum How to use checksums |
279c4ab8cf7f794f8b59e7b1eb87a58ddad504907d91ce961bd5ba16114b5d54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.4
|