# Parametric Equation for Great Circle

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
• p (progress, from 0->1)

Output:

• lat_x,lon_x (point in-between)
-
See this question for some ideas. Once you figure out the initial compass direction Clairaut's relation probably also helps. – Jyrki Lahtonen May 6 '13 at 19:52
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... – Robert C May 6 '13 at 21:27

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)

-
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? – Do Van Hoan Nov 18 '15 at 23:43
@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. – barrycarter Nov 19 '15 at 15:16
What happens if I set f to an imaginary number? I couldn't figure out how this would happen. – Do Van Hoan Nov 22 '15 at 10:51
@barrycarter What happens if one set f to an imaginary number? – Do Van Hoan Nov 23 '15 at 21:35

Perhaps the most succinct and easiest answer (from http://www.physicsforums.com/showpost.php?p=3732362&postcount=5):

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

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

-
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. – Jose Ospina Apr 23 '15 at 10:20
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? – Do Van Hoan Nov 18 '15 at 23:43