Adjust space-drawing for 23x30cm paper
Getty Ritter
6 years ago
6 | 6 | use rand::Rng; |
7 | 7 | |
8 | 8 | fn main() { |
9 |
let |
|
9 | let cent = 0.393701; | |
10 | let (w, h) = (23.0 * cent, 30.0 * cent); | |
10 | 11 | let mut drawing = gt::svg(w, h); |
11 |
drawing.add(gt::rect((0.0, 0.0), ( |
|
12 | drawing.add(gt::rect((0.0, 0.0), (w, h))); | |
12 | 13 | |
13 | 14 | let mut rng = rand::thread_rng(); |
14 | 15 | let per_inch = 5.0; |
15 | 16 | |
16 | 17 | let mut points: HashSet<(usize, usize)> = iproduct!( |
17 | per_inch as usize .. per_inch as usize * 10, | |
18 | per_inch as usize .. per_inch as usize * 13 | |
18 | per_inch as usize .. per_inch as usize * 8, | |
19 | per_inch as usize .. per_inch as usize * 11 | |
19 | 20 | ).collect(); |
20 | 21 | let mut src: Vec<(usize, usize)> = points.clone().into_iter().collect(); |
21 | 22 | rng.shuffle(&mut src); |
57 | 58 | } |
58 | 59 | } |
59 | 60 | |
60 |
|
|
61 | if let Err(e) = drawing.output("space") { | |
62 | eprintln!("{:?}", e); | |
63 | } | |
61 | 64 | } |