MCPcopy Index your code
hub / github.com/Icelk/strange-attractor-renderer

github.com/Icelk/strange-attractor-renderer @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
60 symbols 98 edges 2 files 16 documented · 27%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Strange attractor renderer

A library and CLI to generate strange attractors.

Poisson saturne attractor

By default, this renders the poisson saturne attractor. This should be easy to change through coefficients (when using this as a library), and possibly in the binary (if I add the feature). This can however only render a subset of attractors, those of the polynomial Sprott type (see this page from chaoscope). Adding more should be relatively easy.

Features

All of these are optional.

  • PNG & BMP export
  • 16-bit
  • transparency
  • render depth texture
  • CLI
  • multithreaded
  • brightness control
  • shell completion

Installation

You need to have the latest version of stable Rust installed on your system. Clone this repo. Run cargo install --path . --profile production to install the binary to your user's path.

Documentation

Documentation of the main branch can be found at doc.icelk.dev.

To document with information on which cargo features enables the code, set the environment variable RUSTDOCFLAGS to --cfg docsrs (e.g. in Fish set -x RUSTDOCFLAGS "--cfg docsrs") and then run cargo +nightly doc.

Performance

This should be the fastest possible both in multithreaded and single-threaded mode. When running multithreaded, the main limiting factor is memory speed, not processing power (if you don't have a potato CPU, that is).

Animations

Using the sequence subcommand, you can generate a series of images. Then use the following command to encode it into a H.264 video. See it's --help flag for available options.

$ ffmpeg -i attractor%02d.png -vcodec libx264 -crf 17 -pix_fmt yuv420p out.mp4

You need to change the %02d part to the length of the frame index part of the outputted file name.

Acknowledgements

Many thanks to Björn von Sydow for the inspiration, initial code design, and continuing feedback.

Shell completion

Using the subcommand completion, the binary automatically generates shell completions for your shell and tries to put them in the appropriate location.

When using Bash or Zsh, you should run the binary as root, as we need root privileges to write to their completion directories. Alternatively, use the --print option to yourself write the completion file.

Images

These are generated using the following commands:

# Build binary
$ cargo build --release

# poisson-saturne.png
$ target/release/strange-attractor-renderer -i1000000000 -b -0.25
# solar-sail.png
$ target/release/strange-attractor-renderer -i1000000000 -h2000 -w1800 -b -0.1 -p solar-sail
# solar-sail-220deg.png:
$ target/release/strange-attractor-renderer -i1000000000 -h2000 -w1800 -p solar-sail -a 220

Poisson saturne attractor Solar sail attractor Solar sail attractor from -140°

License

This library and binary artefacts are licensed under the GNU LGPLv3.

Extension points exported contracts — how you extend this code

FloatExt (Interface)
Trait to use the following functions on the float primitives. Here for convenience. [2 implementers]
src/lib.rs
Attractor (Interface)
A strange attractor. This is made generic to allow for speedy execution of all kinds of attractors. [1 implementers]
src/lib.rs
ColorTransform (Interface)
(no doc) [2 implementers]
src/lib.rs

Core symbols most depended-on inside this repo

square
called by 6
src/lib.rs
reset
called by 4
src/lib.rs
magnitude
called by 3
src/lib.rs
send
called by 3
src/lib.rs
num_threads
called by 3
src/lib.rs
write_image
called by 3
src/bin/main.rs
file
called by 3
src/bin/main.rs
next_point
called by 2
src/lib.rs

Shape

Method 32
Class 13
Function 11
Interface 3
Enum 1

Languages

Rust100%

Modules by API surface

src/lib.rs51 symbols
src/bin/main.rs9 symbols

For agents

$ claude mcp add strange-attractor-renderer \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact