summaryrefslogtreecommitdiff
path: root/2d
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-05-15 22:18:00 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-05-15 22:18:00 -0400
commit88d3b0cc3e739c118c8738295f55e735bea50e42 (patch)
tree1d0a9e57add75a56c2ba43cb8302691f4951ad72 /2d
parent9aaf017b70fb9474d3c5be22a27dfcc86d8b41c1 (diff)
Add make-transform*.
* 2d/transform.scm (make-transform*): New procedure.
Diffstat (limited to '2d')
-rw-r--r--2d/transform.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/2d/transform.scm b/2d/transform.scm
index e7b5c31..ea3061d 100644
--- a/2d/transform.scm
+++ b/2d/transform.scm
@@ -27,6 +27,7 @@
#:use-module (srfi srfi-42)
#:use-module (2d vector2)
#:export (make-transform
+ make-transform*
null-transform
identity-transform
transform?
@@ -74,6 +75,15 @@ column-major format."
(array-set! matrix dd 3 3)
(%make-transform matrix)))
+(define* (make-transform* #:optional #:key (translate null-vector2)
+ (scale (vector2 1 1)) (rotate 0))
+ "Return a new transform that is the result of the composition of the
+given TRANSLATE, SCALE, and ROTATE values. Both TRANSLATE and SCALE
+are vector2 values, while ROTATE is a number."
+ (transform* (transform-scale scale)
+ (transform-rotate rotate)
+ (transform-translate translate)))
+
(define null-transform
(%make-transform (make-4x4-matrix)))