Skip to content

Commit

Permalink
Use flasin/flacos to avoid complex numbers.
Browse files Browse the repository at this point in the history
  • Loading branch information
samth committed Jan 28, 2025
1 parent b3d0320 commit b825c2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions images-lib/images/private/deep-flomap-render.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@

(: beckmann-distribution (Flonum Flonum -> Flonum))
(define (beckmann-distribution cos-θ m)
(define x (/ (tan (acos cos-θ)) m))
(define x (/ (tan (flacos cos-θ)) m))
(define m*cos^2-θ (* m cos-θ cos-θ))
(/ (exp (- (* x x))) (* pi m*cos^2-θ m*cos^2-θ)))
(/ (flexp (- (* x x))) (* pi m*cos^2-θ m*cos^2-θ)))

;; ===================================================================================================
;; Pass 1: tracing from a directional light source
Expand Down
4 changes: 2 additions & 2 deletions images-lib/images/private/flomap-transform.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,13 @@
(define ((orthographic-projection α) d)
(define f (/ d 2.0 (sin (* 0.5 (real->double-flonum α)))))
(projection-mapping (λ (ρ) (* (sin ρ) f))
(λ (r) (asin (/ r f)))))
(λ (r) (flasin (/ r f)))))

(: equal-area-projection (Real -> Projection))
(define ((equal-area-projection α) d)
(define f (/ d 4.0 (sin (* 0.25 (real->double-flonum α)))))
(projection-mapping (λ (ρ) (* 2.0 (sin (* 0.5 ρ)) f))
(λ (r) (* 2.0 (asin (/ r 2.0 f))))))
(λ (r) (* 2.0 (flasin (/ r 2.0 f))))))

(: stereographic-projection (Real -> Projection))
(define ((stereographic-projection α) d)
Expand Down

0 comments on commit b825c2d

Please sign in to comment.