summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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."