summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/math/vector.scm16
-rw-r--r--doc/api.texi10
2 files changed, 21 insertions, 5 deletions
diff --git a/chickadee/math/vector.scm b/chickadee/math/vector.scm
index a617910..cbba1e6 100644
--- a/chickadee/math/vector.scm
+++ b/chickadee/math/vector.scm
@@ -35,6 +35,7 @@
vec2-normalize
set-vec2-x!
set-vec2-y!
+ set-vec2!
vec2-normalize!
vec2-mult!
vec2-add!
@@ -55,6 +56,7 @@
vec3-normalize
set-vec3-x!
set-vec3-y!
+ set-vec3!
vec3-normalize!
vec3-mult!
vec3-add!
@@ -150,25 +152,29 @@ polar coordinate (R, THETA)."
(vec3-ref v 2))
(define-inlinable (set-vec2-x! v x)
- "Set the x coordinate of the vec2 V to X."
(vec2-set! v 0 x))
(define-inlinable (set-vec3-x! v x)
- "Set the x coordinate of the vec3 V to X."
(vec3-set! v 0 x))
(define-inlinable (set-vec2-y! v y)
- "Set the y coordinate of the vec2 V to Y."
(vec2-set! v 1 y))
(define-inlinable (set-vec3-y! v y)
- "Set the y coordinate of the vec3 V to Y."
(vec3-set! v 1 y))
(define-inlinable (set-vec3-z! v z)
- "Set the z coordinate of the vec3 V to Z."
(vec3-set! v 2 z))
+(define-inlinable (set-vec2! v x y)
+ (set-vec2-x! v x)
+ (set-vec2-y! v y))
+
+(define-inlinable (set-vec3! v x y z)
+ (set-vec3-x! v x)
+ (set-vec3-y! v y)
+ (set-vec3-z! v z))
+
(define (display-vec2 v port)
(format port "#<vec2 x: ~f y: ~f>" (vec2-x v) (vec2-y v)))
diff --git a/doc/api.texi b/doc/api.texi
index 02662b7..77f6ae0 100644
--- a/doc/api.texi
+++ b/doc/api.texi
@@ -487,6 +487,11 @@ Set the X coordinate of the 2D vector @var{v} to @var{x}.
Set the Y coordinate of the 2D vector @var{v} to @var{y}.
@end deffn
+@deffn {Procedure} set-vec2! @var{v} @var{x} @var{y}
+Set the X and Y coordinates of the 2D vector @var{v} to @var{x} and
+@var{y}, respectively.
+@end deffn
+
@deffn {Procedure} vec2-copy! @var{source} @var{target}
Copy the 2D vector @var{source} into the 2D vector @var{target}.
@end deffn
@@ -571,6 +576,11 @@ Set the Y coordinate of the 3D vector @var{v} to @var{y}.
Set the Z coordinate of the 3D vector @var{v} to @var{z}.
@end deffn
+@deffn {Procedure} set-vec3! @var{v} @var{x} @var{y} @var{z}
+Set the X, Y, and Z coordinates of the 3D vector @var{v} to @var{x},
+@var{y}, and @var{z}, respectively.
+@end deffn
+
@deffn {Procedure} vec3-copy! @var{source} @var{target}
Copy the 3D vector @var{source} into the 3D vector @var{target}.
@end deffn