summaryrefslogtreecommitdiff
path: root/2d
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-05-02 23:44:59 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-05-02 23:44:59 -0400
commit84aa43d4606a99bc18d8d32d2506598f9452e970 (patch)
treef881f0b2846de58e0fa79428c68cb29b5989a7ab /2d
parenta160708eac84695e6d27adfcaed8a40ecb9208fc (diff)
Add transform-position procedure.
* 2d/transform.scm (transform-position): New procedure.
Diffstat (limited to '2d')
-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."