summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/math/vector.scm11
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))