turtle-graphics 0.1.2

Turtle Graphics for Rust
Documentation
  • Coverage
  • 48.28%
    14 out of 29 items documented0 out of 27 items with examples
  • Size
  • Source code size: 14.82 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.76 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • mneumann/turtle-graphics-rs
    6 2 2
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • mneumann

turtle-rs

A turtle graphics engine for Rust. Generates Scalable Vector Graphics (SVG) and Encapsulated PostScript (EPS) out-of-the-box.

Example

extern crate turtle;

use turtle::{Canvas, Turtle};

fn main() {
    let mut t = Canvas::new();
    // move the turtle 100.0 points upwards
    t.forward(100.0);
    // rotate the head of the turtle by 90 degree to the right
    t.right(90.0);
    // move 100.0 forward again (now to the right).
    t.forward(100.0);
    // ...

    // write the graphic (SVG) to stdout.
    t.save_svg(&mut std::io::stdout()).unwrap();

   // or write it as EPS
   t.save_eps(&mut File::create("test.eps").unwrap()).unwrap();
}

For more examples see my Lindenmayer-system library.