As it's been a few days since the last post in this thread, I hope it's okay if I suggest a couple of methods. I found the first
http://mathforum.org/library/drmath/view/52070.html". It's simpler than the one I thought of, but doesn't work when the points are at opposite poles. I'm just a learner myself, so don't take these as definitive answers. There may be neater or better ways of solving it; all comments welcome.
Look away now, if you prefer not to see such a full working out.
(1) If
P and
Q are position vectors from the centre of a sphere (of radius
R) to two points on its surface, provided the points aren't directly opposite each other, you could write a parametric equation for a geodesic (that is: great circle segment, the shortest distance along the surface of the sphere) from point P to point Q like this
\textbf{R}(t)=R\frac{\textbf{P}+t\left ( \textbf{Q}-\textbf{P} \right )}{\left \| \textbf{P}+t\left ( \textbf{Q}-\textbf{P} \right ) \right \|}
where t \in [0,1] (that is:
t runs from 0 to 1, inclusive), so that \textbf{R}(0) = \textbf{P}, and \textbf{R}(1) = \textbf{Q}.
The expression \textbf{P}+t\left ( \textbf{Q}-\textbf{P} \right) is a parametric equation for a line segment from P to Q in Euclidean 3-space, which goes under the surface of the sphere; that's to say, a representative position vector standing for each point on the line segment. The denominator is the magnitude of that position vector. Dividing a vector by its magnitude gives a unit vector in the same direction. If we multiply this unit vector by
R, the radius of sphere, we get the required position vector for a point on the surface of the sphere.
This method fails when points P and Q are on opposite sides of the sphere. Then the line connecting them goes through the centre of the circle, and there are infinitely many possible geodesics between them. To get around this, you could offset P slightly in the direction you want the geodesic to go. Or maybe someone knows a more elegant way?
(2) Alternatively, you could describe the great circle segment in terms of a unit vector in the direction of P and another unit vector at right angles to P in the plane containing P, Q and the centre of the sphere. If P and Q are not exactly opposite each other, define unit vectors thus:
\textbf{e}_1=\frac{\textbf{P}}{\left \| \textbf{P} \right \|}=\frac{\textbf{P}}{R}
\textbf{e}_2=\frac{(\textbf{P}\times \textbf{Q})\times \textbf{P}}{\left \| (\textbf{P}\times \textbf{Q})\times \textbf{P} \right \|}
\textbf{e}_3=\frac{\textbf{P}\times \textbf{Q}}{\left \| \textbf{P}\times \textbf{Q} \right \|} = \frac{\textbf{P}\times \textbf{Q}}{R^2 \sin ( \textbf{P},\textbf{Q} )}
where \sin ( \textbf{P},\textbf{Q} ) is the sine of the angle from
P to
Q. The last of these is a unit vector normal to the plane in which the great circle lies. If P and Q are opposite each other, you can choose an arbitrary unit normal vector \textbf{e}_3, depending on which of the infinitely many great semicircles you want to describe from P to Q (the only condition is that it must be at right angles to P or Q, in other words \textbf{P} \cdot \textbf{e}_3=0), then define the \textbf{e}_2 in terms of the others:
\textbf{e}_2=\textbf{e}_3 \times \textbf{e}_1
In either case,
\textbf{R}(\theta)=R\left [ \left ( \cos \theta \right ) \textbf{e}_1 + \left ( \sin \theta \right ) \textbf{e}_2 \right ],
where \theta runs from 0 to the angle between
P and
Q, which we can get from the definition of the dot product:
\theta \in \left [ 0,\arccos \left ( \frac{\textbf{P} \cdot \textbf{Q}}{R^2} \right ) \right ].
When P and Q are opposite, the direction is determined by the normal vector to the plane of rotation, \textbf{e}_3.