From a73088300c2902e4d9b6c6adf5289fb117012582 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 9 Sep 2013 22:10:16 -0400 Subject: Fix another typo. --- 2d/rect.scm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to '2d') 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) -- cgit v1.2.3