Last active
August 29, 2015 13:57
-
-
Save wiseman/9749487 to your computer and use it in GitHub Desktop.
MH 370 vs. geostationaryish satellite with 3 deg. orbital inclination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def deg2rad(d): | |
return d * math.pi / 180.0 | |
# Convert spherical coordinates to cartesian. | |
def cart(c): | |
return [c[0] * math.sin(c[1]) * math.cos(c[2]), | |
c[0] * math.sin(c[1]) * math.sin(c[2]), | |
c[0] * math.cos(c[1])] | |
# Distance between cartesian coordinates. | |
def dist(c1, c2): | |
dx = abs(c1[0] - c2[0]) | |
dy = abs(c1[1] - c2[1]) | |
dz = abs(c1[2] - c2[2]) | |
return math.sqrt(dx * dx + dy * dy + dz * dz) | |
R_EARTH = 6378 | |
R_GEO = R_EARTH + 35786 | |
sat1 = [R_GEO, math.pi / 2.0, 0.0] | |
sat2 = [R_GEO, math.pi / 2.0 + deg2rad(3.0), 0.0] | |
# -40 latitude | |
plane = [R_EARTH, deg2rad(130.0), 0.0] | |
print dist(cart(sat1), cart(plane)) - dist(cart(sat2), cart(plane)) |
Author
wiseman
commented
Mar 24, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment