diff options
author | David Thompson <dthompson2@worcester.edu> | 2018-09-10 17:12:09 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2018-09-10 17:12:09 -0400 |
commit | 3de33f94c593a5b740dbb4096631b0b2971e2101 (patch) | |
tree | 39c9f2b2230254e5fa852fac0d9206807be6380f | |
parent | c033330cfb6e4489f12ac04ae6ce15b972fa73d7 (diff) |
math: vector: Fix vec2-normalize and vec3-normalize.
* chickadee/math/vector.scm: Move vec2-normalize and vec3-normalize
below the definitions of vec2-normalize! and vec3-normalize! so that
inlining doesn't screw things up.
-rw-r--r-- | chickadee/math/vector.scm | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/chickadee/math/vector.scm b/chickadee/math/vector.scm index da5eef2..a617910 100644 --- a/chickadee/math/vector.scm +++ b/chickadee/math/vector.scm @@ -220,18 +220,6 @@ polar coordinate (R, THETA)." (* (vec3-y v1) (vec3-y v2)) (* (vec3-z v1) (vec3-z v2)))) -(define (vec2-normalize v) - "Return the normalized form of the vec2 V." - (with-new-vec2 new - (vec2-copy! v new) - (vec2-normalize! new))) - -(define (vec3-normalize v) - "Return the normalized form of the vec3 V." - (with-new-vec3 new - (vec3-copy! v new) - (vec3-normalize! new))) - (define-inlinable (vec2-normalize! v) "Normalize the vec2 V in-place." (unless (and (zero? (vec2-x v)) (zero? (vec2-y v))) @@ -249,6 +237,18 @@ polar coordinate (R, THETA)." (set-vec3-y! v (/ (vec3-y v) m)) (set-vec3-z! v (/ (vec3-z v) m))))) +(define (vec2-normalize v) + "Return the normalized form of the vec2 V." + (with-new-vec2 new + (vec2-copy! v new) + (vec2-normalize! new))) + +(define (vec3-normalize v) + "Return the normalized form of the vec3 V." + (with-new-vec3 new + (vec3-copy! v new) + (vec3-normalize! new))) + (define-inlinable (vec2-mult! v x) "Multiply the vec2 V by X, a real number or vec2." (if (real? x) |