|
|
||
|---|---|---|
| crates | ||
| docs | ||
| examples | ||
| src | ||
| static/vectors | ||
| .gitignore | ||
| Cargo.toml | ||
| LICENSE | ||
| bundle.sh | ||
| readme.md | ||
readme.md
Cord
Three-layer 3D geometry system: Source → Trig IR → CORDIC binary.
Cord compiles constructive solid geometry into a trigonometric DAG (TrigGraph), which can be evaluated as f64 reference values, compiled to WGSL shaders for GPU raymarching, or lowered to pure CORDIC shift-and-add arithmetic with zero floating-point operations.
Architecture
[Cordial DSL / SCAD] → AST → SdfNode → TrigGraph → WGSL Shader
→ CORDIC Binary
→ f64 Evaluator
→ Riesz Analysis
[STL/OBJ Mesh] → BVH → Sparse Grid → RANSAC → Monogenic Classify → SDF Tree
Crates
| Crate | Description |
|---|---|
| cord-trig | TrigGraph IR — the universal intermediate representation |
| cord-parse | SCAD lexer and parser |
| cord-sdf | SDF node tree, AST → SdfNode → TrigGraph lowering |
| cord-shader | TrigGraph → WGSL raymarcher codegen |
| cord-cordic | TrigGraph → CORDIC compiler and evaluator |
| cord-format | ZCD archive format (ZIP container for all layers) |
| cord-render | Standalone wgpu raymarcher |
| cord-decompile | Mesh → SDF decompiler (RANSAC + monogenic classification) |
| cord-riesz | 3D Riesz transform, monogenic signals, spatial cepstrum |
| cordial | Rust DSL for CSG with parallel composition patterns |
| cord-gui | Interactive iced-based editor (not published) |
File Formats
| Extension | Description |
|---|---|
.crd |
Cordial source |
.cord |
Raw CORDIC binary (magic: CORD) |
.trig |
Serialized TrigGraph (magic: TRIG) |
.zcd |
Zipped Cord archive containing any combination of layers |
Quick Start
# View a .scad file
cargo run -- view examples/test.scad
# Compile to .zcd archive
cargo run -- build input.scad -o output.zcd
# Dump generated WGSL
cargo run -- shader input.scad
# Launch the GUI editor
cargo run -p cord-gui
# Verify CORDIC accuracy
cargo run -- verify --word-bits 32
Cordial Language
See docs/cordial-reference.md for the full language reference. Quick taste:
let shell: Obj = diff(sphere(5), sphere(4))
let hole: Obj = cylinder(1.5, 12)
let result: Obj = diff(shell, union(hole, rotate_x(hole, pi/2)))
cast(result)
Cordial as Rust DSL
use cordial::prelude::*;
let shell = sphere(5.0).difference(sphere(4.0));
let hole = cylinder(1.5, 12.0);
let result = shell.difference(hole.clone() | hole.rotate_x(90.0));
let wgsl = result.to_wgsl();
let cordic = result.to_cordic();
License
Unlicensed — pszsh