diff options
author | David Thompson <dthompson2@worcester.edu> | 2020-10-12 20:46:39 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2020-10-13 08:46:52 -0400 |
commit | 69413418072d45ccdb1bc1d682fbf18913bd291a (patch) | |
tree | c7d24f5d9b89efac7738941b218a800812b8fbd3 | |
parent | 762057a93447ad15e64008e3a820b32772a71c4b (diff) |
math: vector: Add vec2= and vec3= procedures.
-rw-r--r-- | chickadee/math/vector.scm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/chickadee/math/vector.scm b/chickadee/math/vector.scm index 2269486..4206206 100644 --- a/chickadee/math/vector.scm +++ b/chickadee/math/vector.scm @@ -25,6 +25,8 @@ #:export (vec2 vec2/polar vec2? + vec2= + vec3= vec2->pointer vec2-copy vec2-copy! @@ -101,6 +103,15 @@ (define (make-null-vec3) (wrap-vec3 (make-f32vector 3) #f)) +(define-inlinable (vec2= a b) + (and (= (vec2-x a) (vec2-x b)) + (= (vec2-y a) (vec2-y b)))) + +(define-inlinable (vec3= a b) + (and (= (vec3-x a) (vec3-x b)) + (= (vec3-y a) (vec3-y b)) + (= (vec3-z a) (vec3-z b)))) + (define-syntax-rule (with-new-vec2 name body ...) (let ((name (make-null-vec2))) body ... name)) |