Skip to content

Commit

Permalink
Method optimizations in calc
Browse files Browse the repository at this point in the history
  • Loading branch information
jamestaylr committed Jun 12, 2015
1 parent bdd414f commit 6691a07
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/modules/calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,7 @@ def get_heading_angle(heading, current_point, target_point):
return heading - angle

def point_proximity(current_point, target_point):
a = math.sin(math.radians(current_point['latitude']))
b = math.sin(math.radians(target_point['latitude']))
c = math.cos(math.radians(current_point['latitude']))
d = math.cos(math.radians(target_point['latitude']))

e = a * b + c * d * math.cos((math.radians(target_point['longitude'] - current_point['longitude'])))
f = math.acos(e)
distance = f * 6371 * 1000

return (distance <= point_proximity_radius)
return (distance(current_point, target_point) <= point_proximity_radius)

def distance(point1, point2):
a = math.sin(math.radians(point1['latitude']))
Expand Down

0 comments on commit 6691a07

Please sign in to comment.