diff orpg/mapper/map_utils.py @ 20:072ffc1d466f traipse_dev

2nd attempt. Still untested.
author sirebral
date Sat, 25 Jul 2009 19:23:25 -0500
parents 4385a7d0efd1
children 449a8900f9ac
line wrap: on
line diff
--- a/orpg/mapper/map_utils.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/map_utils.py	Sat Jul 25 19:23:25 2009 -0500
@@ -44,16 +44,13 @@
    yt = float(yt)
 
    # Coincident points?
-   if x1 == x2 and y1 == y2:
-       d = distance_between(xt, yt, x1, y1)
+   if x1 == x2 and y1 == y2: d = distance_between(xt, yt, x1, y1)
    else:
        dx = x2 - x1
        dy = y2 - y1
        u = ((xt - x1) * dx + (yt - y1) * dy) / (dx*dx + dy*dy)
-       if u < 0:
-           d = distance_between(xt, yt, x1, y1)
-       elif u > 1:
-           d = distance_between(xt, yt, x2, y2)
+       if u < 0: d = distance_between(xt, yt, x1, y1)
+       elif u > 1: d = distance_between(xt, yt, x2, y2)
        else:
            xr = x1 + u * dx
            yr = y1 + u * dy