From c747738b7b9de8f7218156893e82429a25a822a9 Mon Sep 17 00:00:00 2001 From: "Jakob L. Kreuze" Date: Mon, 20 Jul 2020 15:23:45 -0400 Subject: Fix `degrees->radians'. --- cl-raytracer.lisp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cl-raytracer.lisp') diff --git a/cl-raytracer.lisp b/cl-raytracer.lisp index 23b5232..f30099a 100644 --- a/cl-raytracer.lisp +++ b/cl-raytracer.lisp @@ -121,7 +121,7 @@ format (PPM), writing the result to `(current-output-port)'." (defun to-radians (d) "Convert D, a value in degrees, to radians." - (* d (/ PI 360))) + (* d (/ PI 180))) ;;; @@ -285,7 +285,7 @@ format (PPM), writing the result to `(current-output-port)'." (defun coord-to-ray (x y) "Return the ray corresponding to the point X, Y on the viewport plane." (let* ((dist 1.0) - (top (* dist (tan (to-radians camera-fov)))) + (top (* dist (tan (/ (to-radians camera-fov) 2)))) (right (* top image-aspect-ratio)) (bottom (- top)) (left (- right)) -- cgit v1.3