summaryrefslogtreecommitdiff
path: root/2d
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-09-09 22:10:16 -0400
committerDavid Thompson <dthompson@member.fsf.org>2013-09-09 22:10:16 -0400
commita73088300c2902e4d9b6c6adf5289fb117012582 (patch)
tree2c79fd5ee7c86cab780b0d98bf21164d6e1c2719 /2d
parentbf4370645763ae4f74b78e758cc55a538520505e (diff)
Fix another typo.
Diffstat (limited to '2d')
-rw-r--r--2d/rect.scm18
1 files changed, 17 insertions, 1 deletions
diff --git a/2d/rect.scm b/2d/rect.scm
index 1257142..4cabac3 100644
--- a/2d/rect.scm
+++ b/2d/rect.scm
@@ -32,6 +32,10 @@
rect-y
rect-x2
rect-y2
+ rect-center-x
+ rect-center-y
+ rect-half-width
+ rect-half-height
rect-width
rect-height
rect-position
@@ -41,7 +45,7 @@
rect-union
rect-clip
rect-within?
- rect-intesects?
+ rect-intersects?
rect-contains?))
;;;
@@ -65,6 +69,18 @@
(define (rect-y2 rect)
(+ (rect-y rect) (rect-height rect) -1))
+(define (rect-center-x rect)
+ (+ (rect-x rect) (rect-half-width rect)))
+
+(define (rect-center-y rect)
+ (+ (rect-y rect) (rect-half-height rect)))
+
+(define (rect-half-width rect)
+ (/ (rect-width rect) 2))
+
+(define (rect-half-height rect)
+ (/ (rect-height rect) 2))
+
(define (rect-position rect)
"Return the top-left corner of RECT as a vector2."
(vector2 (rect-x rect)