Skip to content

Commit b825c2d

Browse files
committed
Use flasin/flacos to avoid complex numbers.
Related to racket/typed-racket#1428
1 parent b3d0320 commit b825c2d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

images-lib/images/private/deep-flomap-render.rkt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060

6161
(: beckmann-distribution (Flonum Flonum -> Flonum))
6262
(define (beckmann-distribution cos-θ m)
63-
(define x (/ (tan (acos cos-θ)) m))
63+
(define x (/ (tan (flacos cos-θ)) m))
6464
(define m*cos^2-θ (* m cos-θ cos-θ))
65-
(/ (exp (- (* x x))) (* pi m*cos^2-θ m*cos^2-θ)))
65+
(/ (flexp (- (* x x))) (* pi m*cos^2-θ m*cos^2-θ)))
6666

6767
;; ===================================================================================================
6868
;; Pass 1: tracing from a directional light source

images-lib/images/private/flomap-transform.rkt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,13 @@
294294
(define ((orthographic-projection α) d)
295295
(define f (/ d 2.0 (sin (* 0.5 (real->double-flonum α)))))
296296
(projection-mapping (λ (ρ) (* (sin ρ) f))
297-
(λ (r) (asin (/ r f)))))
297+
(λ (r) (flasin (/ r f)))))
298298

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

305305
(: stereographic-projection (Real -> Projection))
306306
(define ((stereographic-projection α) d)

0 commit comments

Comments
 (0)