Expand description
§barnsley
barnsley is a library and executeable for exploring iterated function systems. It’s based and inspired by pyifs written by James Tauber for Python.
§Running the executable
Simply install using cargo install barnsley
. Run barnsley
in a terminal to get a CLI.
Each command is documented there.
§Defining an iterated function system
An iterated function is defined by a vector of transforms. You add them one at a time.
use barnsley::{ifs::IFS, transform::AffineTransform, image::Image};
let mut ifs = IFS::new();
ifs.add_transform(AffineTransform::random().into());
let width: usize = 100;
let height: usize = 100;
let num_points: usize = 100;
let num_iterations: usize = 10;
let mut image = Image::new(width, height);
ifs.evaluate(&mut image, num_points, num_iterations);
§Defining iterated function systems in files
There are two kinds of files that are used to define a IFS:
- templates: These are toml files specify which transforms you want to run but not their parameters. Each time you run one you will get a different result. They’re good for generating many different images.
- configs: These are json files that fully specify the transforms and their parameters. You can use them to regenerate an image at a higher resolution, change the color scheme, or explore how changing parameters impacts the IFS.
Modules§
- a struct and associated methods for animations
- core definition for an IFS run that can be serialized to a file
- iterated function system
- two-dimensional image representation
- representation of an non-parameterized, random IFS
- functions used in the IFS
- useful support functionality