summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/math/vector.scm13
1 files changed, 7 insertions, 6 deletions
diff --git a/chickadee/math/vector.scm b/chickadee/math/vector.scm
index 3cc1a9a..7e847e3 100644
--- a/chickadee/math/vector.scm
+++ b/chickadee/math/vector.scm
@@ -273,13 +273,14 @@ polar coordinate (R, THETA) with an arbitrary ORIGIN point."
(define-inlinable (vec3-normalize! v)
"Normalize the vec3 V in-place."
- (unless (and (zero? (vec3-x v))
- (zero? (vec3-y v))
- (zero? (vec3-z v)))
+ (unless (and (= (vec3-x v) 0.0)
+ (= (vec3-y v) 0.0)
+ (= (vec3-z v) 0.0))
(let ((m (vec3-magnitude v)))
- (set-vec3-x! v (/ (vec3-x v) m))
- (set-vec3-y! v (/ (vec3-y v) m))
- (set-vec3-z! v (/ (vec3-z v) m)))))
+ (set-vec3! v
+ (/ (vec3-x v) m)
+ (/ (vec3-y v) m)
+ (/ (vec3-z v) m)))))
(define (vec2-normalize v)
"Return the normalized form of the vec2 V."