Giter Club home page Giter Club logo

rust-mandelbrot's Introduction

rust-mandelbrot

This is an extension of the code you can find in the (excellent) book Programming in Rust - 2nd Edition that renders Mandelbrot sets to png files. I've added a TUI interface to enable viewing the image in the terminal, positioning and zooming into the image and the ability to render the current image as a PNG with a key press.

Compatibility

  • Mac yes
  • Windows no (I need to change from Termion to Crossterm, see Byron/dua-cli#2
  • Linux I don't know

Running

Currently, just like the book example, you pass in a filename, image size and window into the set using two complex numbers for the top left and bottom right corners respectively.

cargo run --release -- /tmp/mandel.png 2048x1080 -2.8,2.0 2.5,-2.0 1

Pressing Return/Enter will save the current image to the file path you give. Subsequent images are automatically numbered, so you will get mandel1.png, mandel2.png and so on. It will overwrite any existing images so save to a different folder each time.

Move the selection around with WASD keys and press Z to zoom. You can't zoom back out and accuracy issues will start to make the images very boring. These are both exercises for me in the future or for the interested reader.

TUI screen shot

Sample rendered image

Issues

If you're interested in playing around with the code check out the Issues for things to do.

rust-mandelbrot's People

Contributors

justinhj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.