MCPcopy Index your code
hub / github.com/cortesi/spacecurve

github.com/cortesi/spacecurve @v0.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.2.0 ↗ · + Follow
466 symbols 1,069 edges 45 files 235 documented · 50%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Discord

Hilbert curve

generated with: 'scurve allrgb hilbert'

A space-filling curve is a continuous surjection $f:[0,1]\to[0,1]^d$ for $d\ge 2$. In discrete spaces, this is an ordering of grid cells that visits every cell; some orderings preserve adjacency (e.g., Hilbert), while others trade adjacency for simplicity (e.g., Morton/Z-order).

This project contains implementations of various space-filling curves, plus tools for visualising and working with them.

spacecurve

crates.io docs.rs MIT

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);

scurve

crates.io MIT

A command-line tool and GUI for generating images of space-filling curves.

Install with:

cargo install scurve

playground

A GUI for visualising space-filling curves and their properties, written in Rust with egui and compiled to WebAssembly.

Space-filling curve viewer

related blog posts

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:

community

Want to contribute? Have ideas or feature requests? Come tell me about it on Discord.

Extension points exported contracts — how you extend this code

SpaceCurve (Interface)
SpaceCurve is the core trait for space‑filling curves. Invariants and preconditions (apply to all implementations): - ` [8 …
crates/spacecurve/src/spacecurve/mod.rs

Core symbols most depended-on inside this repo

point
called by 23
crates/spacecurve/src/curves/gray.rs
curve_from_name
called by 19
crates/spacecurve/src/lib.rs
pow_u32
called by 15
crates/spacecurve/src/curves/onion.rs
length
called by 12
crates/scurve/src/map.rs
index
called by 9
crates/spacecurve/src/curves/gray.rs
checkbit
called by 9
crates/spacecurve/src/curves/hilbertn.rs
repo_shell
called by 8
xtask/src/main.rs
rotpair
called by 8
crates/spacecurve/src/curves/hilbertn.rs

Shape

Function 326
Method 95
Class 36
Enum 8
Interface 1

Languages

Rust100%

Modules by API surface

crates/scurve/tests/cli_commands.rs40 symbols
crates/spacecurve/src/curves/onion.rs33 symbols
xtask/src/main.rs32 symbols
crates/scurve/src/main.rs22 symbols
crates/scurve-gui/src/lib.rs22 symbols
crates/scurve/src/map.rs21 symbols
crates/spacecurve/src/registry.rs20 symbols
crates/spacecurve/src/curves/hcurve.rs19 symbols
crates/spacecurve/src/ops.rs17 symbols
crates/spacecurve/src/curves/gray.rs16 symbols
crates/scurve-gui/src/widgets.rs15 symbols
crates/scurve-gui/src/threed.rs15 symbols

For agents

$ claude mcp add spacecurve \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact