Write a program that gets coordinates of two objects on Earth, and calculates how far they are from each other directly in space (a straight line through Earth) and on the surface (through the shortest route on the Earth surface). Don't take into account that polar and equatorial radii differ, consider Earth's radius 6371.0 km.
Write a program that gets 4 numbers:
- Obj1 latitude ( [ -90.0° ; 90.0° ] )
- Obj1 longitude ( ( -180.0° ; 180.0° ] )
- Obj2 latitude ( [ -90.0° ; 90.0° ] )
- Obj2 longitude ( ( -180.0° ; 180.0° ] )
and gives 2 numbers: the physical distance in space between two objects and the distance of the shortest route to go through on the Earth surface. In the context of the task Earth is a perfect sphere with no highlands/mountains or lowlands, etc..
Positive and negative values are for different hemispheres, degrees with decimal part representing minutes and seconds (e.g. -38.20 means -38°12'00", so no need to overthink). No need to check the input values, they're guaranteed to be in the range.
Hardcore. Calculate two values (in degrees) that represent:
- Direction of the shortest route from Obj1 to Obj2 (0° is the north, 180° is the south (-180° is represented like 180° and so on), positive degrees are on the east side (90° is the east), negative - on the west (-90° is the west)), of course before any movement, only in the starting point;
- From the perspective of the one of the objects, angle between its horizon and the physical position of the second object below the horizon (inclination, here always below the horizon, e.g. 90° means directly on the opposite side of Earth).
Overall output:
physical_distance shortest_route shortest_route_direction inclination_below_horizon