summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2017-04-27 22:17:50 -0400
committerDavid Thompson <dthompson2@worcester.edu>2017-04-27 22:17:50 -0400
commit2c3d74bc23947a998fa1f330c5ab025804866c99 (patch)
tree6e9b658c3cf2ee067076abbc884d978b1d599e8f
parent4ea65a486a6753641dee5f42f14abcaa398e8907 (diff)
math: Add lerp procedure.
* chickadee/math.scm (lerp): New procedure.
-rw-r--r--chickadee/math.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/chickadee/math.scm b/chickadee/math.scm
index adb7d8b..e9ebc6d 100644
--- a/chickadee/math.scm
+++ b/chickadee/math.scm
@@ -21,7 +21,8 @@
square
clamp
min
- max)
+ max
+ lerp)
#:replace (min max))
(define pi 3.14159265358979323846)
@@ -55,3 +56,7 @@ actually less than MAX."
((_ a b ...)
(let ((m (max b ...)))
(if (> a m) a m)))))
+
+(define-inlinable (lerp start end alpha)
+ (+ (* start (- 1.0 alpha))
+ (* end alpha)))