summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--2d/transform.scm6
1 files changed, 6 insertions, 0 deletions
diff --git a/2d/transform.scm b/2d/transform.scm
index df2f943..e7b5c31 100644
--- a/2d/transform.scm
+++ b/2d/transform.scm
@@ -33,6 +33,7 @@
transform-matrix
transpose
transform-vector2
+ transform-position
transform+
transform*
transform-translate
@@ -103,6 +104,11 @@ column-major format."
(* y (array-ref m 1 1))
(array-ref m 1 3)))))
+(define (transform-position transform)
+ "Extract 2D vector from TRANSFORM."
+ (let ((m (transform-matrix transform)))
+ (vector2 (array-ref m 0 3) (array-ref m 1 3))))
+
(define (transform+ . transforms)
"Return the sum of all given transformation matrices. Return
null-transform if called without any arguments."