MCPcopy Create free account
hub / github.com/RocketMap/RocketMap / calc_distance

Function calc_distance

pogom/search.py:653–666  ·  view source on GitHub ↗
(pos1, pos2)

Source from the content-addressed store, hash-verified

651
652
653def calc_distance(pos1, pos2):
654 R = 6378.1 # km radius of the earth
655
656 dLat = math.radians(pos1[0] - pos2[0])
657 dLon = math.radians(pos1[1] - pos2[1])
658
659 a = math.sin(dLat / 2) * math.sin(dLat / 2) + \
660 math.cos(math.radians(pos1[0])) * math.cos(math.radians(pos2[0])) * \
661 math.sin(dLon / 2) * math.sin(dLon / 2)
662
663 c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a))
664 d = R * c
665
666 return d
667
668
669# Delay each thread start time so that logins only occur ~1s

Callers 2

search_worker_threadFunction · 0.85
gym_requestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected