From bbc4620da0af1d3cf89b62c1df31ef172dbb0ebe Mon Sep 17 00:00:00 2001 From: Keuin Date: Tue, 12 Apr 2022 10:29:26 +0800 Subject: Bugfix: fixpoint on ray is calculated incorrectly, causing objects being stretched. --- main_simple_scanner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main_simple_scanner.cpp b/main_simple_scanner.cpp index bc4e279..7279e12 100644 --- a/main_simple_scanner.cpp +++ b/main_simple_scanner.cpp @@ -103,8 +103,8 @@ public: for (int j = -img_hh; j < img_hh; ++j) { // axis y for (int i = -img_hw; i < img_hw; ++i) { // axis x const vec3d off{ - .x=1.0 * i / half_width, - .y=1.0 * j / half_height, + .x=1.0 * i / img_hw * half_width, + .y=1.0 * j / img_hh * half_height, .z=0.0 }; // offset on screen plane const auto dir = r + off; // direction vector from camera to current pixel on screen -- cgit v1.2.3