added flight mechanics

This commit is contained in:
2025-09-29 22:46:23 -05:00
parent 8f8c3f232e
commit 2bd64cb748
9 changed files with 102 additions and 95 deletions

17
simulator/utils.py Normal file
View File

@@ -0,0 +1,17 @@
import math
def haversine_nm(lat1, lon1, lat2, lon2):
# Earth radius in nautical miles
R = 3440.065
phi1, phi2 = math.radians(lat1), math.radians(lat2)
dphi = math.radians(lat2 - lat1)
dlambda = math.radians(lon2 - lon1)
a = (
math.sin(dphi / 2) ** 2
+ math.cos(phi1) * math.cos(phi2) * math.sin(dlambda / 2) ** 2
)
c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a))
return R * c