So, I am trying to find the parametric equation of the shortest curve on a sphere between two arbitrary given points on a sphere.
Starting from cartesian coordinate system,
My plan so far is,
find the normal vector from two vectors $v_1, v_2$ made by the given two points on a sphere and the origin of the sphere.
find angles between the normal and $z$-axis by using inner product with two vectors which made by making the normal's $x,y$ components $0$.
find a 3d rotation matrix $A$ with respect to the angles found.
find inverse of A, and rotate $v_1, v_2$ to $xy$-plane.
use parametric equation of a circle $\vec r(t) = \langle r\cos(t), r\sin(t)\rangle$, and find corresponding range of $t$, $(a\leq t\leq b)$ for the angle of rotated $v_1, v_2$.
finally, the parametric equation of the shortest curve is $A\vec r(t)$, $(a\leq t\leq b)$
So my question is :
- Is this right method?
- Is there any simpler method?
- what would be the general function of it to generate points of the curve as a code, python or any pesudo..
You start off okay. Define two vectors from the center of the sphere to the the identified points (lets call them $ u, v$). You would use the cross product to find the normal vector (not the inner product). But, what you really want are two orthogonal vectors in this plane, rather than the normal to the plane. You can choose either $ u$ or $ v$ to be one of those vectors.
Lets start by normalizing these vectors.
$\hat u = \frac { u}{\| u\|}\\ \hat v = \frac {v}{\|v\|}$
The subtract the projection to find a vector in the plane orthogonal to $mathbf u.$
$w = \hat v - (\hat u\cdot \hat v)\hat u$
And normalize $w$
$\hat w = \frac {w}{\|w\|}$
Parametric equations....
$(x,y,z) = (r\cos \theta) \hat u + (r\sin\theta) \hat w$