summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-08-03 20:35:22 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-08-25 19:33:07 -0400
commit908223915a494151e306cca6d9a9a6c2a2f1e429 (patch)
tree72fd212a76a16fb8cf6a4b05386053b792c2c55a
parente8f5b8cca92c41cd4a9a62c297ec01a38c786063 (diff)
Fix normalize procedure.
* sly/vector.scm (normalize): Preserve dimensionality in the case where magnitude is 0.
-rw-r--r--sly/vector.scm2
1 files changed, 1 insertions, 1 deletions
diff --git a/sly/vector.scm b/sly/vector.scm
index ecaad2a..a41176e 100644
--- a/sly/vector.scm
+++ b/sly/vector.scm
@@ -151,7 +151,7 @@ both be 3D vectors."
"Normalize the vector V."
(let ((m (magnitude v)))
(if (zero? m)
- 0
+ v
(vector-map (lambda (i n)
(/ n m))
v))))