Crates.io | hilbert_curve_generator |
lib.rs | hilbert_curve_generator |
version | 0.1.2 |
source | src |
created_at | 2023-05-13 02:26:44.460556 |
updated_at | 2023-05-15 16:40:07.939408 |
description | A WIP Hilbert Space-Filling Curve Coordinate Generator |
homepage | |
repository | https://github.com/benjaminwgordon/HSFC-generator |
max_upload_size | |
id | 863490 |
size | 13,023 |
A WIP Hilbert Space-Filling Curve Coordinate Generator. Can produce cartesian coordinates for the vertices of a Hilbert Space-Filling Curve in 2 or 3 dimensions using the Skilling Transform Method.
This module contains functionality for generating the Cartesian coordinates of the vertices in a Hilbert Space-Filling Curve in both 2D and 3D.
It also contains utility functions for converting the output vertices into different formats:
Brgc is the Binary Reflected Gray Code Iterator
This module generates the cartesian coordinates of each vertex in the HSFC using a technique that begins with a list of the first n binary numbers counted using the Binary Reflected Gray Code counting system.
The iterator exposed by this module can be used to generate points in a BRGC of any magnitude, although for the typical purposes of generating square hilbert curves and cubic hilbert cubes, the number of generated points will typically be p^n, where n is the number of dimensions for the resulting cartesian coordinates (2D and 3D currently supported), and p is the number of data bits for each coordinate (each side of your square/cube will have 2^p vertices)
This module contains functions for applying the Skilling Transform to an existing
Vec
The Skilling Transform is an algorithm for generating the cartesian coordinates of vertices in a Hilbert curve without using the traditional recursive method.
I've optimized for readability and ease of understanding in the code, since the algorithm is not immediately clear. There was a good deal of trial and error in implementing this algorithm. If I spend more time on this project, I'll try replacing all the string manipulation with bit manipulation and benchmark the speed difference.