Problem: Generating smooth curves from sparse control points is complex without using heavy math frameworks or relying on high-level GPU-bound graphics stacks.
Solution: An interactive Rust application implementing Chaikin's subdivision algorithm in a custom software renderer (Bresenham's and midpoint circle lines) drawing directly onto a 1D pixel buffer.
- Interactive Canvas: Add control points using mouse left-clicks.
- Real-Time Drag and Drop: Drag existing control points to reshape the curve in real time.
- Animated Subdivision: View a 7-step progressive animation of Chaikin's corner-cutting algorithm.
- Strict Boundary Conditions: Pins endpoints to ensure open curve limits remain anchored.
- Custom Software Renderer: Uses Bresenham's line algorithm and midpoint circle drawing directly on a 1D pixel buffer.
- Robust Corner Cases: Handles 0, 1, and 2 control points gracefully, displaying status alerts and fallback rendering modes.
Mouse Input → AppState (points/drag/animation) → Chaikin Algorithm → Software Renderer (Bresenham) → Pixel Buffer → Window Display
Cargo.toml: Project manifest & external dependenciesREADME.md: Project overview and quickstart guideTODO.md: Requirements checklist and audit logdocs/: Detailed documentation & specificationsaudit.md: Functional audit test checklistguide.md: Comprehensive logic, flow, Rust features, and Q&Arequirements.md: Core requirements and specifications
src/: Application source codelib.rs: Library entrypoint exposing modulesmain.rs: OS event loop, input polling, and main rendererapp.rs: AppState, animation ticks, and drag-and-drop state machinechaikin.rs: Mathematical implementation of corner-cutting algorithmrenderer.rs: Bresenham lines, circle filling, and text rendering primitives
tests/: Automated testing suiteschaikin_tests.rs: Core algorithmic math and point length edge case testsintegration-tests.rs: Full state transition and functional audit verification tests
You must have Rust and Cargo installed. To install them, follow the instructions at rustup.rs.
To run the interactive application:
cargo run --releaseTo run the full suite of unit and integration tests:
cargo test- Left Click: Place a new control point on the canvas (when not animating).
- Left Click + Drag: Drag an existing control point in real time.
- Enter / Right Click: Start / Restart the 7-step subdivision animation.
- C / R: Clear the screen, reset the state, and start over.
- Escape: Exit the application.
For an in-depth explanation of the application's logic, flow, software rendering math, and the specific Rust language features utilized, please see:
- Comprehensive Logic, Flow & Rust Architecture Guide
This guide includes:
- Structural analysis of
app.rs,chaikin.rs, andrenderer.rs. - Rust concept explanation (trait derivations, pattern matching, memory safety, slices, lifetimes).
- Full answers to the audit checklist in
docs/audit.md. - Advanced Q&A testing understanding of Rust memory safety and performance design.
- CV & Portfolio
- lem-in-e — Go algorithmic routing solver