10
$\begingroup$

So I've been doing a lot of searching and haven't found exactly what I'm looking for. My math skills are a bit rusty, so I haven't had luck deriving this on my own.

What I'm looking for is an equation (or set of equations) where I can plug in starting and ending spherical coordinates, plus a percentage (ie [0,1]) and output spherical coordinates of some point in between (ie, progress along a great circle).

The idea is basically to chart the progress of a plane between two cities and draw it on a globe or map.

Inputs:

  • lat1,lon1
  • lat2,lon2
  • r (radius)
  • p (progress, from 0->1)

Output:

  • lat_x,lon_x (point in-between)
$\endgroup$
2
  • $\begingroup$ See this question for some ideas. Once you figure out the initial compass direction Clairaut's relation probably also helps. $\endgroup$ May 6, 2013 at 19:52
  • $\begingroup$ I appreciate the suggestion. What I'm really looking for is an equation already derived that I can plug numbers into. Haven't had a luck deriving anything on my own... $\endgroup$
    – Calteran
    May 6, 2013 at 21:27

2 Answers 2

14
$\begingroup$

Ok, so I found what I was looking for at Ed Williams' awesome Aviation Formulary:

Given (lat1,lon1), (lat2,lon2), and progress fraction f=[0,1]

d = acos(sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos(lon1 - lon2))
A = sin((1 - f) * d) / sin(d)
B = sin(f * d) / sin(d)
x = A * cos(lat1) * cos(lon1) + B * cos(lat2) * cos(lon2)
y = A * cos(lat1) * sin(lon1) + B * cos(lat2) * sin(lon2)
z = A * sin(lat1) + B * sin(lat2)

lat_f = atan2(z, sqrt(x^2 + y^2))
lon_f = atan2(y,x)

$\endgroup$
8
  • $\begingroup$ What happens if I set $f$ not in [0,1]. For example $f$ = 2, would I get the point outside great circle and have double the length of great circle? $\endgroup$ Nov 18, 2015 at 23:43
  • 1
    $\begingroup$ @DoVanHoan No, f=2 would be the same as f=0 and f=1. Basically, f=2 would be looping around the circle twice (720 degrees), which is the same as looping once (360 degrees) or not at all (0 degrees). Now, if you set f to an imaginary number, you might have something. $\endgroup$
    – user2469
    Nov 19, 2015 at 15:16
  • $\begingroup$ What happens if I set f to an imaginary number? I couldn't figure out how this would happen. $\endgroup$ Nov 22, 2015 at 10:51
  • 1
    $\begingroup$ Does this formula automatically always choose the shorter direction on the great arc? $\endgroup$
    – j13r
    Mar 9, 2017 at 4:04
  • 2
    $\begingroup$ @user2469 I don't think that's right. At f=0, we are at lat1,lon1. At f=1, we are at lat2,lon2. If you past 1, you will continue along the same great circle, and eventually you will come around to lat1,lon1 again. Exactly how far you need to go for that to happen depends on how far apart the point 1 and point 2 are. $\endgroup$
    – hypehuman
    Sep 14, 2020 at 13:38
8
$\begingroup$

Perhaps the most succinct and easiest answer is (as quoted from here)

You are given two points $u$ and $v$ on the unit sphere. Think of them as position vectors $\vec u$ and $\vec v$ . It is easy enough to calculate cross products. Calculate $\vec w = (\vec u \times \vec v)\times\vec u$. Then $\vec w$ and $\vec u$ are unit vectors perpendicular to each other and in the plane of the circle. So a parameterization of the circle is $$\vec R (t)=\vec u \cos t+\vec w \sin t.$$

Correction: $\vec w$ is only a unit vector if $\vec u$ and $\vec v$ are perpendicular.

$\endgroup$
2
  • $\begingroup$ I have seen another paremeterization as R(t) = u * sin(th0(t)) / sin(th) + v * sin(th1(t)) / sin(th), with th being the total angle between u and v, th0 the angle between u and R and th1 the angle between R and v. Though probably related, I still don't see how this expression can be deduced from the one above. $\endgroup$ Apr 23, 2015 at 10:20
  • $\begingroup$ What happens if I set $f$ not in [0,1]. For example $f$ = 2, would I get the point outside great circle and have double the length of great circle? $\endgroup$ Nov 18, 2015 at 23:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .