This crate provides a very easy to use Differential Growth algorithm as well as an example sketch using the excellent nannou crate.
It's as simple as providing a Vec of starting points, calling [DifferentialGrowth::tick()
] to advance one iteration of the algorithm and obtaining the new state
using [DifferentialGrowth::get_points()
].
Get up and running quickly by using an included point generator function like [generate_points_on_circle()
] to generate your starting points.
Having a basic knowledge of the differential growth algorithm is highly recommended: - https://inconvergent.net/generative/differential-line/ - https://inconvergent.net/2016/shepherding-random-growth/
The best way to understand this crate is by taking a look at /example
folder. You can run it on any platform running cargo run --example example
.
Otherwise, below is a quick reference on how to use this crate.
```rust
// Generate a set of starting points.
// You do not have to use the included helper function,
// you could for example pass points drawn by the mouse.
let startingpoints: Vec
// Advance the algorithm 1 iteration. dg.tick();
// Get the newly calculated points.
let pointstodraw: Vec
// draw the result by // - drawing a line between consecutive Vec elements. // - drawing a line between the first and the last element. ```