diff options
author | David Thompson <dthompson2@worcester.edu> | 2021-05-12 20:48:18 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2021-05-12 20:48:18 -0400 |
commit | 4804001bab8c10a1ae11146d3dfc11aa05e03766 (patch) | |
tree | 7a5066d8aab36e1b2f0512f3aa598a6463a4a199 | |
parent | 3152304d7c04c19e8780dccab3ac4793fde06ad2 (diff) |
math: vector: Minor style tweaks.
-rw-r--r-- | chickadee/math/vector.scm | 13 |
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." |