#! /usr/bin/python3 # =================================================================== # Given the circumference of a sphere (the earth) and a great circle # distance on the sphere (the earth), calculate the great circle # angle with the center of the sphere (the earth) # =================================================================== # FYI: pi = 3.141592653589793 # =================================================================== from math import pi, radians, cos, sin, asin, sqrt # ------------------------------------------------------------------- # given a great circle distance and circumference, # calculate its angle with the center of the earth # gs great circle distance # cr circumference of circle # return angle in (degrees, radians) # ------------------------------------------------------------------- def great_circle_angle(gs,cr): a1 = 360.0 * (gs/cr) # degrees a2 = (pi/180.0) * a1 # radians return (a1,a2) # return degrees and radials # ------------------------------------------------------------------- # ---- main # ------------------------------------------------------------------- if '__main__' == __name__: # ---- earth radm = 3959 # earth radius in miles radk = 6371 # earth radius in kilometers cirm = 24875.11 # earth circumference in miles cirk = 40030.14 # earth circumference in kilometers gcd1 = cirm / 8.0 # great circle distance (45 degrees) gcd2 = gcd1 * 2 # great circle distance (90 degrees) gcd3 = gcd1 * 3 # great circle distance (135 degrees) gcd4 = gcd1 * 4 # great circle distance (180 degrees) for gs in [ gcd1, gcd2, gcd3, gcd4 ]: deg,rad = great_circle_angle(gs,cirm) print(f'Great Circle Angle: {deg} (degrees)') print()