Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calculate_radius(point1, point2):
- # print "Calculating distance between points:"
- # print point1
- # print point2
- if point1 is None:
- return 10
- p1 = np.array(point1["location"])
- p2 = np.array(point2["location"])
- dist = np.linalg.norm(p1 - p2)
- time_delta = point2["time"] - point1["time"]
- # print "dist: %f" % dist
- # print "time delta: %i" % time_delta
- blocks_per_second = (dist / time_delta) * 1000
- # print "blocks per second: %f" % blocks_per_second
- return int(round(blocks_per_second))
Add Comment
Please, Sign In to add comment