gdritter repos axidraw-experiments / master src / circles.rs
master

Tree @master (Download .tar.gz)

circles.rs @masterraw · history · blame

extern crate gunpowder_treason as gt;
#[macro_use] extern crate itertools;
extern crate rand;

fn main() {
    let mut drawing = gt::svg(8.5, 11.0);

    for y in 1..11 {
        drawing.add(gt::line(0.75, y as f64)
                    .to(8.5 - 0.75, y as f64));
    }
    for x in 0..8 {
        drawing.add(gt::line(0.75 + x as f64, 1.0)
                    .to(0.75 + x as f64, 10.0));
    }
    for (x, y) in iproduct!(0..7, 1..10) {
        for _ in 0..(rand::random::<u32>() % 4) + 1 {
            drawing.add(gt::circle(
                (1.25 + x as f64, 0.5 + y as f64),
                0.2 * rand::random::<f64>(),
            ));
        }
    }

    if let Err(e) = drawing.output("circles") {
        eprintln!("{}", e);
    }
}