summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-04-12 10:29:26 +0800
committerKeuin <[email protected]>2022-04-12 10:29:26 +0800
commitbbc4620da0af1d3cf89b62c1df31ef172dbb0ebe (patch)
tree81219b74013c4ec9e275f89b740d5d4df52ec5c2
parent403ea4bb9fdd18f09d4ba38086e7bd2374220f62 (diff)
Bugfix: fixpoint on ray is calculated incorrectly, causing objects being stretched.
-rw-r--r--main_simple_scanner.cpp4
1 files 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