aboutsummaryrefslogtreecommitdiff
path: root/util/Geo.py
diff options
context:
space:
mode:
Diffstat (limited to 'util/Geo.py')
-rw-r--r--util/Geo.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/util/Geo.py b/util/Geo.py
index a9243de..be3e93e 100644
--- a/util/Geo.py
+++ b/util/Geo.py
@@ -4,7 +4,6 @@ from bisect import *
import random
def pointWithinBoundingBox(point, bb): #this could be in 4 lines, but I'm lazy.
return sum([(point[i % 2] <= bb[i]) == (i>1) for i in range(4)]) == 4
-print pointWithinBoundingBox((118,21), (10,8,298,42))
def addLocations(l1,l2):
return tuple([l1[i]+l2[i] for i in range(len(l1))])
def gaussian(x,height,center,width):
@@ -13,9 +12,12 @@ def gaussian(x,height,center,width):
c=width
return a*math.exp(-((x-b)**2)/(2*c**2))
def dist(l1, l2):
- return math.sqrt(sum([(l1[i]-l2[i])**2 for i in range(len(l1))]))
+ return math.sqrt((l1[0]-l2[0])**2+(l1[1]-l2[1])**2)
+ #return math.sqrt(sum([(l1[i]-l2[i])**2 for i in range(len(l1))]))
def randomLoc(boundingBox): #TODO: make less shitty
loc = []
loc.append(random.randint(0, boundingBox[0]))
loc.append(random.randint(0, boundingBox[1]))
return tuple(loc)
+def approxexp(x):
+ return 1+x+x**2/2+x**3/6