summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2020-10-20 08:27:32 -0400
committerDavid Thompson <dthompson2@worcester.edu>2020-11-13 22:26:44 -0500
commit7154a283f343684ec66bc9fa5bd089f4cc272f47 (patch)
treef425c5aa4d7ba19068635240a97a632966337908
parentcf69fb3440d59bddc9b37374330b12e1365a407c (diff)
math: vector: Add vec2-cross procedure.
-rw-r--r--chickadee/math/vector.scm5
1 files changed, 5 insertions, 0 deletions
diff --git a/chickadee/math/vector.scm b/chickadee/math/vector.scm
index e2720c6..3476326 100644
--- a/chickadee/math/vector.scm
+++ b/chickadee/math/vector.scm
@@ -34,6 +34,7 @@
vec2-y
vec2-magnitude
vec2-dot-product
+ vec2-cross
vec2-normalize
set-vec2-x!
set-vec2-y!
@@ -243,6 +244,10 @@ polar coordinate (R, THETA) with an arbitrary ORIGIN point."
(* (vec3-y v1) (vec3-y v2))
(* (vec3-z v1) (vec3-z v2))))
+(define-inlinable (vec2-cross v1 v2)
+ (- (* (vec2-x v1) (vec2-x v2))
+ (* (vec2-y v1) (vec2-y v2))))
+
(define-inlinable (vec3-cross! dest v1 v2)
(set-vec3! dest
(- (* (vec3-y v1) (vec3-z v2))