1
2 import math
3 from bisect import *
4 import random
6 """Returns whether or not a point (x,y) is within a bounding box (xmin, ymin, xmax, ymax)"""
7 return all([(point[i % 2] <= bb[i]) == (i>1) for i in range(4)])
8
10 return tuple([l1[i]+l2[i] for i in range(len(l1))])
11
13 a=height
14 b=center
15 c=width
16 return a*math.exp(-((x-b)**2)/(2*c**2))
17
19 return math.sqrt((l1[0]-l2[0])**2+(l1[1]-l2[1])**2)
20
22 loc = []
23 loc.append(random.randint(0, boundingBox[0]))
24 loc.append(random.randint(0, boundingBox[1]))
25 return tuple(loc)
26
28 """Approximates exp with a 3 term Taylor Series."""
29 return 1+x+x**2/2+x**3/6
30
32 a=height
33 b=center
34 c=width
35 return a*((math.exp(-((x-b))/(c)))**2)*(math.exp(-((y))/(0.2*c)))**2
36
39 self.x = x
40 self.y = y
43