I need to find a point between two geolocations g1 and g2 (defined by longitude/latitude in radians). Let's say a positive integer n:
- if n = 1, I'm looking for the middle point m1 between g1 and g2.
- if n = 2, I'm looking for the 'quarter' point m2 between g1 and g2 (middle point between g1 and m1.
- ...
For the middle point, I found the following formula:
$$dLon = lon2 - lon1$$ $$Bx = cos(lat2) \times cos(dLon)$$ $$By = cos(lat2) \times sin(dLon)$$
$$lat3 = atan2(sin(lat1) + sin(lat2), \sqrt{(cos(lat1) + Bx} \times (cos(lat1) + Bx) + By \times By))$$ $$lon3 = lon1 + atan2(By, cos(lat1) + Bx)$$
So I could simply reuse this formula (n) times to solve this problem, but maybe there is a way to do it in one operation, while reducing the complexity of the computation?