math: grid: Simplify a formula.
authorDavid Thompson <dthompson2@worcester.edu>
Sun, 9 Dec 2018 19:44:59 +0000 (14:44 -0500)
committerDavid Thompson <dthompson2@worcester.edu>
Sun, 9 Dec 2018 19:44:59 +0000 (14:44 -0500)
* chickadee/math/grid.scm (slide): Simplify formula for setting new
goal coordinates.

chickadee/math/grid.scm

index 9982f90..3a2f83f 100644 (file)
@@ -66,10 +66,10 @@ needed to make the rectangles no longer overlap."
     (if (< x-fix y-fix)
         (if (= goal-x x1)
             (set-vec2-x! goal (+ (vec2-x goal) x-fix))
-            (set-vec2-x! goal (+ (vec2-x goal) (- x-fix))))
+            (set-vec2-x! goal (- (vec2-x goal) x-fix)))
         (if (= goal-y y1)
             (set-vec2-y! goal (+ (vec2-y goal) y-fix))
-            (set-vec2-y! goal (+ (vec2-y goal) (- y-fix)))))))
+            (set-vec2-y! goal (- (vec2-y goal) y-fix))))))
 
 \f
 ;;;