diff --git a/src/bin/flat.rs b/src/bin/flat.rs index 8a6b76a..a6e1789 100644 --- a/src/bin/flat.rs +++ b/src/bin/flat.rs @@ -28,7 +28,16 @@ pub fn main() { let canvas = create_drawing_window("Refraction"); canvas.draw(|gc| { gc.canvas_height(1000.0); + gc.line_width(0.5); + + // gc.canvas_height(100.0); + // gc.center_region(-100.0, -200.0, 100.0, 0.0); + // gc.line_width(0.1); + space.draw_background(gc); + + // gc.stroke_color(Color::Rgba(0.5, 1.0, 0.0, 1.0)); + // space.draw_fan(gc, vec2(0.0, -0.5 * space.external_halflength), vec2(1.0, 1.0), 1.0); space.draw_rays(gc, &space); let space = Rc::new(space); @@ -38,6 +47,8 @@ pub fn main() { Box::new(Inside { space: space.clone() }), ]; space.draw_rays(gc, parts.as_slice()); + // gc.stroke_color(Color::Rgba(1.0, 0.0, 1.0, 1.0)); + // parts.draw_fan(gc, vec2(0.0, space.u(-0.5 * space.external_halflength)), vec2(1.0, 1.0), 1.0); }); }); } @@ -162,7 +173,6 @@ impl Interesting for Coil { } fn draw_rays(&self, gc: &mut Vec, tracer: &(impl Rayable + ?Sized)) { - gc.line_width(0.5); gc.stroke_color(Color::Rgba(1.0, 0.5, 0.0, 1.0)); tracer.draw_fan(gc, vec2(-500.0, 0.0), vec2(1.0, 0.0), 1.0); gc.stroke_color(Color::Rgba(0.0, 0.5, 1.0, 1.0)); @@ -181,9 +191,10 @@ impl Interesting for Rect { } fn draw_rays(&self, gc: &mut Vec, tracer: &(impl Rayable + ?Sized)) { - gc.line_width(0.5); gc.stroke_color(Color::Rgba(1.0, 0.5, 0.0, 1.0)); tracer.draw_fan(gc, vec2(-500.0, 0.0), vec2(1.0, 0.0), 1.0); + gc.stroke_color(Color::Rgba(0.5, 1.0, 0.0, 1.0)); + tracer.draw_fan(gc, vec2(0.0, -0.5 * self.external_halflength), vec2(1.0, 1.0), 1.0); gc.stroke_color(Color::Rgba(0.0, 0.5, 1.0, 1.0)); tracer.draw_fan(gc, vec2(0.0, -0.5 * self.external_halflength), vec2(1.0, 1.0), 1.0); gc.stroke_color(Color::Rgba(0.2, 0.7, 0.0, 1.0));