Skip to content

Commit 3dc1594

Browse files
authored
Add THR export and segment subsampling pipeline stage (#166)
## Summary - Add THR (Theta-Rho) serializer for polar sand tables (Sisyphus, Oasis, Dune Weaver) with `atan2(x,y)` convention, continuous theta unwinding, rho normalization to [0,1], metadata comment headers, and 5-decimal precision matching Sandify - Add segment subsampling as pipeline stage 9 (after join) to subdivide long Cartesian line segments before polar conversion, preventing unexpected arcs in THR output - Enable THR checkbox in the export panel with download wiring ## Details ### New files - **`crates/mujou-export/src/thr.rs`** — THR serializer with ~20 unit tests + 1 end-to-end test - **`crates/mujou-pipeline/src/subsample.rs`** — `subsample()` function with 18 unit tests ### Pipeline changes - `STAGE_COUNT` bumped to 10 with new `Subsampled` typed stage - `PipelineConfig.subsample_max_length` (default 2.0 px) - `StagedResult.subsampled` field; `final_polyline()` returns subsampled output - `StageMetrics::Subsample` variant in diagnostics - Cache resume support for the new stage ### UI changes - THR checkbox enabled in export panel with Blob download - `StageId` mapping updated for new pipeline index ### Tests - ~40 new unit tests across `thr.rs` and `subsample.rs` - 2 cherry blossoms integration tests (`cherry_blossoms_pipeline_to_thr`, `cherry_blossoms_pipeline_to_thr_with_mask`) - All 380 tests pass, zero clippy warnings ### Docs - THR format spec added to `formats.md` - Implementation checklist updated (Phases 0–5 checked off)
2 parents 23e4cf8 + 29ff341 commit 3dc1594

File tree

18 files changed

+1669
-229
lines changed

18 files changed

+1669
-229
lines changed

crates/mujou-export/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
//! mujou-export: Pure format serializers (sans-IO)
22
//!
3-
//! Converts polylines into output formats. Currently supports SVG.
4-
//! Future formats: THR, G-code, DXF, PNG.
3+
//! Converts polylines into output formats. Currently supports SVG and THR.
4+
//! Future formats: G-code, DXF, PNG.
55
66
pub mod svg;
7+
pub mod thr;
78

89
pub use svg::{SvgMetadata, build_path_data, to_diagnostic_svg, to_segment_diagnostic_svg, to_svg};
10+
pub use thr::{ThrMetadata, to_thr};

0 commit comments

Comments
 (0)