summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-06-10 21:08:48 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-06-10 21:08:48 -0400
commitc8e2b160356afb500c9e2eaeb62279aa2bbc9fd4 (patch)
tree02edfc57aa6e4163cad6bc4daeea3ef6bb0bff65
parentab68b1a6b2454585adbede7b4c5fb6a7c8d68650 (diff)
Tweak transform API.
* 2d/transform.scm (make-transform*): Delete it. (transform-translate, transform-scale): Rename. (translate, scale): New procedures.
-rw-r--r--2d/transform.scm32
1 files changed, 7 insertions, 25 deletions
diff --git a/2d/transform.scm b/2d/transform.scm
index 09e4398..9b7e05d 100644
--- a/2d/transform.scm
+++ b/2d/transform.scm
@@ -27,20 +27,11 @@
#:use-module (srfi srfi-42)
#:use-module (2d math)
#:use-module (2d vector)
- #:export (make-transform
- make-transform*
- null-transform
- identity-transform
- transform?
- transform-matrix
- transpose
- transform-vector2
- transform-position
- transform+
- transform*
- transform-translate
- transform-scale
- rotate-x rotate-y rotate-z
+ #:export (make-transform null-transform identity-transform
+ transform? transform-matrix
+ transpose transform-vector2 transform-position
+ transform+ transform*
+ scale translate rotate-x rotate-y rotate-z
orthographic-projection perspective-projection))
(define-record-type <transform>
@@ -76,15 +67,6 @@ column-major format."
(array-set! matrix dd 3 3)
(%make-transform matrix)))
-(define* (make-transform* #:optional #:key (translate #(0 0))
- (scale #(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)
- (rotate-z rotate)
- (transform-translate translate)))
-
(define null-transform
(%make-transform (make-4x4-matrix)))
@@ -149,7 +131,7 @@ identity-transform if called without any arguments."
(%make-transform m3)))
(reduce mul identity-transform transforms))
-(define (transform-translate v)
+(define (translate v)
"Return a new transform that translates the x and y axes by the
vector V."
(make-transform 1 0 0 0
@@ -157,7 +139,7 @@ vector V."
0 0 1 0
(vx v) (vy v) 0 1))
-(define (transform-scale v)
+(define (scale v)
"Return a new transform that scales the X and Y axes by the vector
V."
(make-transform (vx v) 0 0 0