summaryrefslogtreecommitdiff
path: root/chickadee/math.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2019-12-19 08:17:45 -0500
committerDavid Thompson <dthompson2@worcester.edu>2020-04-07 16:10:23 -0400
commitb5a93156dfc743aec69987e03e89d27735b615dd (patch)
tree9c7fc6741916f3d31332abe64eb40b54e53a2374 /chickadee/math.scm
parentadc7e0dbd1a5b511641e85c46f0e7894353f0cda (diff)
math: Add degrees->radians and radians->degrees procedures.
Diffstat (limited to 'chickadee/math.scm')
-rw-r--r--chickadee/math.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/chickadee/math.scm b/chickadee/math.scm
index b695e92..050dac1 100644
--- a/chickadee/math.scm
+++ b/chickadee/math.scm
@@ -23,7 +23,9 @@
clamp
min
max
- lerp)
+ lerp
+ degrees->radians
+ radians->degrees)
#:replace (min max))
(define pi 3.14159265358979323846)
@@ -65,3 +67,9 @@ actually less than MAX."
(define-inlinable (lerp start end alpha)
(+ (* start (- 1.0 alpha))
(* end alpha)))
+
+(define-inlinable (degrees->radians degrees)
+ (/ (* pi degrees) 180.0))
+
+(define-inlinable (radians->degrees radians)
+ (/ (* 180.0 radians) pi))