summaryrefslogtreecommitdiff
path: root/fennel-raytracer.fnl
diff options
context:
space:
mode:
authorJakob L. Kreuze <zerodaysfordays@sdf.org>2020-07-20 15:23:45 -0400
committerJakob L. Kreuze <zerodaysfordays@sdf.org>2020-07-20 15:23:45 -0400
commitc747738b7b9de8f7218156893e82429a25a822a9 (patch)
tree2c68693e0469f4ea82fb0d04a1538931d8339dfe /fennel-raytracer.fnl
parent79fb23ef37d3e98bad18f5211720393ce8cd9a52 (diff)
Fix `degrees->radians'.
Diffstat (limited to 'fennel-raytracer.fnl')
-rw-r--r--fennel-raytracer.fnl4
1 files changed, 2 insertions, 2 deletions
diff --git a/fennel-raytracer.fnl b/fennel-raytracer.fnl
index ca5e400..462ac5a 100644
--- a/fennel-raytracer.fnl
+++ b/fennel-raytracer.fnl
@@ -130,7 +130,7 @@ multiplication."
(fn degrees->radians [d]
"Convert D, a value in degrees, to radians."
- (* d (/ math.pi 360)))
+ (* d (/ math.pi 180)))
(local image-width 1920)
(local image-height 1080)
@@ -144,7 +144,7 @@ multiplication."
(fn coordinate->ray [x y]
"Return the ray corresponding to the point X, Y on the viewport plane."
(let [dist 1.0
- top (* dist (math.tan (degrees->radians camera-fov)))
+ top (* dist (math.tan (/ (degrees->radians camera-fov) 2)))
right (* top image-aspect-ratio)
bottom (- top)
left (- right)