Calculating components of travel of two spherical coordinates

151 Views Asked by At

I have been trying to wrap my head around this formula here: https://www.movable-type.co.uk/scripts/latlong.html#bearing . The formula is calculating bearing from one coordinate to another. I was hoping I could just use calculated x and y values (later provided into arctan at the end of the formula) as pure component-wise distance measurements (in meters) from the origin point. I was hoping I could use the calculated x and y components since they provide an accurate bearing from the origin point.

However, I am not too versed in 3d polar based math. My feeble attempt was to simply multiply each of the components by R (radius of the planet), which got me close to the actual value, but isn't quite right.

To test how close my values were, I tried a pair of coordinates (y, 0.0) & (y, 1.0) (latitude, longitude) where y = [-89 to +89] and compared the known distance measurement with the faulty distance measurement as a ratio and got the following graph:

error radio graph

So the only points where simply multiplying the components by R (the radius of the planet) become accurate are when the origin point approaches the poles of the planet.