From a80857bca13ad0a2451b2fe592c41a9a5dab5c67 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 12 Jan 2021 00:50:25 +0000 Subject: [PATCH] otterlib: wip preview, reorg a bit nfc Signed-off-by: Ian Jackson --- src/bin/otterlib.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/bin/otterlib.rs b/src/bin/otterlib.rs index 967cd2ce..200c412b 100644 --- a/src/bin/otterlib.rs +++ b/src/bin/otterlib.rs @@ -59,24 +59,24 @@ fn preview(items: Vec) { angle: VisiblePieceAngle(default()), face }; + const BORDER: f64 = 1.; + let bbox = pc + .bbox_approx(); + let mut bbox = bbox + .iter() + .map(|PosC(xy)| xy.iter().map(|&p| p as f64).collect::>()) + .collect::>(); + for xy in &mut bbox[0] { *xy -= BORDER } + for xy in &mut bbox[1] { *xy += BORDER } + let size = izip!(&bbox[0], &bbox[1]) + .map(|(min,max)| max-min) + .collect::>(); for face in 0..(if only1 { 1 } else { max_faces }) { print!(r#""#); if face < pc.nfaces() { let pri = getpri(face.into()); - const BORDER: f64 = 1.; - let bbox = pc - .bbox_approx(); - let mut bbox = bbox - .iter() - .map(|PosC(xy)| xy.iter().map(|&p| p as f64).collect::>()) - .collect::>(); - for xy in &mut bbox[0] { *xy -= BORDER } - for xy in &mut bbox[1] { *xy += BORDER } - let size = izip!(&bbox[0], &bbox[1]) - .map(|(min,max)| max-min) - .collect::>(); let viewport = [bbox[0].clone(), size.clone()] .iter().cloned() -- 2.30.2