]> gitweb.michael.orlitzky.com - dead/census-tools.git/blob - src/GPS.py
Initial commit.
[dead/census-tools.git] / src / GPS.py
1 from math import sqrt
2
3
4 class Coordinates:
5 """Represents a set of GPS coordinates (latitude/longitude)."""
6
7 def __init__(self):
8 self.latitude = 0
9 self.longitude = 0
10
11
12
13 def CalculateDistance(p1, p2):
14 """
15 Calculate the distance between two Coordinates, p1 and p2.
16 """
17 delta_x = p2.longitude - p1.longitude
18 delta_y = p2.latitude - p1.latitude
19 euclidean_distance = sqrt(delta_x**2 + delta_y**2)
20
21 return euclidean_distance