diff options
author | David Thompson <dthompson2@worcester.edu> | 2022-10-24 21:13:38 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2022-10-24 21:13:38 -0400 |
commit | 86b4b72fa1fdcc424febe327bfc42e33c1eb5b38 (patch) | |
tree | 43a949f26d037e577df85abf7a064eca49ee2df3 | |
parent | 4047c0d0a92eae8a7394b4caa479d0cb6dd9017c (diff) |
math: rect: Fix vec2-clamp-to-rect implementation.
-rw-r--r-- | chickadee/math/rect.scm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/chickadee/math/rect.scm b/chickadee/math/rect.scm index 2b94014..9e605d8 100644 --- a/chickadee/math/rect.scm +++ b/chickadee/math/rect.scm @@ -296,7 +296,9 @@ fit completely within RECT2." (define (vec2-clamp-to-rect v rect) "Return a new vec2 with the x and y coordinates of the vec2 V restricted so that they are within the bounds of RECT." - (vec2-clamp-to-rect! (vec2-copy v) rect)) + (let ((v* (vec2-copy v))) + (vec2-clamp-to-rect! v* rect) + v*)) (define (rect-clamp rect1 rect2) "Return a new rect that adjusts the location of RECT1 so that it is |