From e752536430541bd1a0a6e3a2c5d53f15fedb7c3a Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Sat, 17 Jul 2021 21:52:11 -0700 Subject: [PATCH] camera: correct x/y calculations in Camera::render. --- rtchallenge/src/camera.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtchallenge/src/camera.rs b/rtchallenge/src/camera.rs index 9936814..464e597 100644 --- a/rtchallenge/src/camera.rs +++ b/rtchallenge/src/camera.rs @@ -147,8 +147,8 @@ impl Camera { /// ``` pub fn render(&self, w: &World) -> Canvas { let mut image = Canvas::new(self.hsize, self.vsize, BLACK); - for y in 0..self.hsize { - for x in 0..self.vsize { + for y in 0..self.vsize { + for x in 0..self.hsize { let ray = self.ray_for_pixel(x, y); let color = w.color_at(&ray); image.set(x, y, color);