diff options
| -rw-r--r-- | cl-raytracer.lisp | 4 | ||||
| -rw-r--r-- | fennel-raytracer.fnl | 4 | ||||
| -rw-r--r-- | gerbil-raytracer.ss | 4 | ||||
| -rw-r--r-- | r6rs-raytracer.scm | 4 | ||||
| -rw-r--r-- | r7rs-raytracer.scm | 4 |
5 files changed, 10 insertions, 10 deletions
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)) 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) diff --git a/gerbil-raytracer.ss b/gerbil-raytracer.ss index 9251bd4..188da7a 100644 --- a/gerbil-raytracer.ss +++ b/gerbil-raytracer.ss @@ -137,12 +137,12 @@ ;; Convert D, a value in degrees, to radians. (def (degrees->radians d) (let ((pi 3.1415926535897932384626433)) - (* d (/ pi 360)))) + (* d (/ pi 180)))) ;; Return the ray corresponding to the point X, Y on the viewport plane. (def (coordinate->ray x y) (let* ((dist 1.0) - (top (* dist (tan (degrees->radians camera-fov)))) + (top (* dist (tan (/ (degrees->radians camera-fov) 2)))) (right (* top image-aspect-ratio)) (bottom (- top)) (left (- right)) diff --git a/r6rs-raytracer.scm b/r6rs-raytracer.scm index 2d3f525..8ae7885 100644 --- a/r6rs-raytracer.scm +++ b/r6rs-raytracer.scm @@ -162,12 +162,12 @@ ;; Convert D, a value in degrees, to radians. (define (degrees->radians d) (let ((pi 3.1415926535897932384626433)) - (* d (/ pi 360)))) + (* d (/ pi 180)))) ;; Return the ray corresponding to the point X, Y on the viewport plane. (define (coordinate->ray x y) (let* ((dist 1.0) - (top (* dist (tan (degrees->radians camera-fov)))) + (top (* dist (tan (/ (degrees->radians camera-fov) 2)))) (right (* top image-aspect-ratio)) (bottom (- top)) (left (- right)) diff --git a/r7rs-raytracer.scm b/r7rs-raytracer.scm index 08f9bce..06c9c4e 100644 --- a/r7rs-raytracer.scm +++ b/r7rs-raytracer.scm @@ -197,12 +197,12 @@ ;; Convert D, a value in degrees, to radians. (define (degrees->radians d) (let ((pi 3.1415926535897932384626433)) - (* d (/ pi 360)))) + (* d (/ pi 180)))) ;; Return the ray corresponding to the point X, Y on the viewport plane. (define (coordinate->ray x y) (let* ((dist 1.0) - (top (* dist (tan (degrees->radians camera-fov)))) + (top (* dist (tan (/ (degrees->radians camera-fov) 2)))) (right (* top image-aspect-ratio)) (bottom (- top)) (left (- right)) |