generated with: 'scurve allrgb hilbert'
A space-filling curve is a continuous surjection
This project contains implementations of various space-filling curves, plus tools for visualising and working with them.
A Rust library for generating and working with space-filling curves.
// 2D Hilbert curve on an 8x8 grid (order 3)
let curve = spacecurve::curve_from_name("hilbert", 2, 8)?;
println!(
"{}D Hilbert length: {} cells",
curve.dimensions(),
curve.length()
);
let index = 10;
let point = curve.point(index);
println!("Point at index {index}: {:?}", point);
let round_trip = curve.index(&point);
println!("Index for {:?}: {round_trip}", point);
assert_eq!(round_trip, index);A command-line tool and GUI for generating images of space-filling curves.
Install with:
cargo install scurveA GUI for visualising space-filling curves and their properties, written in Rust with egui and compiled to WebAssembly.
Development on spacecurve (and its ancestors) is usually spurred along by posts on my blog. Some of spacecurve's features are documented and illustrated in the following posts:
- Portrait of the Hilbert Curve
- Generating colour maps with space-filling curves
- Hilbert Curve + Sorting Algorithms + Procrastination = ?
Want to contribute? Have ideas or feature requests? Come tell me about it on Discord.