summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2020-08-28 22:07:21 -0400
committerDavid Thompson <dthompson2@worcester.edu>2020-10-11 22:18:43 -0400
commitdba563f8b17ce2a543ef98c1bd64b68f5c5272c6 (patch)
tree1863cce3ce5fc5e9f082d19bbb73b93446dc83ff
parent38d57e587c205f436e24461bea1d7bc4aec46fba (diff)
math: Delete square procedure.
It's just not useful.
-rw-r--r--chickadee/math.scm4
-rw-r--r--chickadee/math/vector.scm8
2 files changed, 4 insertions, 8 deletions
diff --git a/chickadee/math.scm b/chickadee/math.scm
index b970526..c61b862 100644
--- a/chickadee/math.scm
+++ b/chickadee/math.scm
@@ -20,7 +20,6 @@
pi/2
2pi
cotan
- square
clamp
min
max
@@ -37,9 +36,6 @@
"Return the cotangent of Z."
(/ 1.0 (tan z)))
-(define-inlinable (square x)
- (* x x))
-
(define-inlinable (clamp min max x)
"Restrict X to the range defined by MIN and MAX. Assumes that MIN is
actually less than MAX."
diff --git a/chickadee/math/vector.scm b/chickadee/math/vector.scm
index 31aff07..2269486 100644
--- a/chickadee/math/vector.scm
+++ b/chickadee/math/vector.scm
@@ -212,13 +212,13 @@ polar coordinate (R, THETA)."
(define-inlinable (vec2-magnitude v)
"Return the magnitude of the vec2 V."
- (sqrt (+ (square (vec2-x v)) (square (vec2-y v)))))
+ (sqrt (+ (* (vec2-x v) (vec2-x v)) (* (vec2-y v) (vec2-y v)))))
(define-inlinable (vec3-magnitude v)
"Return the magnitude of the vec3 V."
- (sqrt (+ (square (vec3-x v))
- (square (vec3-y v))
- (square (vec3-z v)))))
+ (sqrt (+ (* (vec3-x v) (vec3-x v))
+ (* (vec3-y v) (vec3-y v))
+ (* (vec3-z v) (vec3-z v)))))
(define-inlinable (vec2-dot-product v1 v2)
"Return the dot product of the vec2s V1 and V2."