This project lets you draw points on a canvas and visualize a curve generated by Chaikin's algorithm. The curve is smoothed step by step, and the animation runs for 7 steps before restarting.
Click to Add Points: Click on the canvas to add control points.
-
Animation: Press Enter to start the animation and smooth the curve.
-
Clear Points: Press Delete to remove all points.
-
Exit: Press Escape to close the app.
-
Rust: Install Rust from here.
-
macroquad crate: Used for window handling and rendering.
Create a new Rust project:
Copy
Edit
cargo new chaikin_curve
cd chaikin_curve
Add macroquad to Cargo.toml:[dependencies]
macroquad = "0.3"
Replace the contents of src/main.rs with the provided code.cargo run
Usage
Click on the canvas to place control points.-
Press Enter to start the animation and smooth the curve.
-
Press Delete to clear all points.
-
Press Escape to exit the app.
Chaikin's Algorithm Chaikin’s algorithm smooths the curve by generating new points between each pair of existing points. The process is repeated for 7 steps to refine the curve.