This is the companion source code for the book Introduction to Chaos, Fractals and Dynamical Systems. You can buy the book at Bookshop.org or Amazon.
For usage instructions please scroll down to the bottom of the page.
Here is a sampling of the included fractals and programs.
- GPU rendering; subroutines for Julia set function, color map, and color mode
- Histogram coloring algorithm
- Keyboard and mouse controls
- Separate control window with adjustable sliders
cargo run --bin=mandel_julia dragon
- Game logic runs on GPU
- Click and drag to set pixels
cargo run --bin=game_of_life
- GPU rendering via geometry shader
- Control window with adjustable sliders
cargo run --bin=bifurcation
- Simple recursive fractal
cargo run --bin=cantor
- Runs in your terminal, no GPU needed
cargo run --bin=1d_life '50[?]' -i 20
- Over a dozen IFS fractals to play with
cargo run --bin=sierpinski-ifs
cargo run --bin=redmoscl
Instructions based on Ubuntu 22.04.1.
- Install Rust: https://rustup.rs/
- Install required tools and libraries:
sudo apt install -y build-essential cmake git libfontconfig-dev pkg-config
- Clone source code and run!
git clone https://github.com/introtochaosbook/rust-fractal-lab.git
cd rust-fractal-lab
cargo run --bin=game_of_life
Note: if you are using a virtual machine, you may have issues with OpenGL especially if you are using an older kernel version. Some things to try:
- Ensure your VM has 3D graphics acceleration enabled
- Use the glxinfo utility to check
- Upgrade to a newer kernel
Instructions based on macOS Big Sur. I am using Homebrew (https://brew.sh/) as package manager.
- Install git:
brew install git
- Install rust: https://rustup.rs/
- The installer will ask if you want to customize installation options. This is not necessary - just choose option #1.
- Clone source code and run!
git clone https://github.com/introtochaosbook/rust-fractal-lab.git
cd rust-fractal-lab
cargo run --bin=game_of_life
Instructions based on Windows 10.
- Install git: https://git-scm.com/download/win
- Install Rust: https://rustup.rs/
- If the installer prompts you to install Visual C++ prerequisites, choose option #1 and let it proceed.
- The installer will also ask if you want to customize installation options. This is not necessary - just choose option #1 again.
- At this point, make sure link.exe is found in your PATH. To do this, open a command prompt and type link.exe. If you get "'link.exe' is not recognized as an internal or external command, operable program or batch file.", then you'll need to manually add an entry to your PATH environment variable. In my case I had to add: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64. Why couldn't the installer just have done this for me? 🤷
- Clone source code and run!
git clone https://github.com/introtochaosbook/rust-fractal-lab.git
cd rust-fractal-lab
cargo run --bin=game_of_life
Note: when running in a virtual machine, you may get an error like this:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: GlutinCreationError(NoAvailablePixelFormat)', src\bin\mandel_julia\main.rs:211:58
Unfortunately, I was unable to find a fix or workaround.