fix angle conversion problem

This commit is contained in:
Robby Findler 2014-05-12 21:37:14 -05:00
parent 3f3e6e4cb4
commit 83abd94dd0
2 changed files with 9 additions and 2 deletions

View File

@ -349,8 +349,10 @@
(equal? arg +nan.0)))))
(define (angle->proper-range α)
(define whole-part (modulo (round α) 360))
(define decimal-part (- α (round α)))
(define eα (inexact->exact α))
(define rα (round eα))
(define whole-part (modulo rα 360))
(define decimal-part (- eα rα))
(if (and (zero? whole-part)
(negative? decimal-part))
(+ 360 decimal-part)

View File

@ -996,6 +996,11 @@
=>
(rectangle 100 10 'solid (color 0 255 0)))
;; make sure that rotation with a very small negative number doesn't crash
(test (image? (rotate -0.0000000000000001 (rectangle 10 10 'solid 'blue)))
=>
#t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; regular polygon