# Regular paths along surface of sphere

I'm trying to create a program where a small ball is supposed to move along the surface of a sphere, which is given by its radius $r$ and the center $c$.

The movement should be repetitive, so that after a certain time $T$ the ball is back at its original position. I'm calculating a value $t$ based on $T$ and the elapsed time $E$ in the following fashion: $$t = \frac{\operatorname{mod}(E, T)}{T}, t \in [0,1[$$

The next step is the parameterization of the movement. I was able to achieve simple circular movements in the $x$-$y$-plane ($x$-$z$ and $y$-$z$, respectively) by simply using polar coordinates: \begin{align*} \varphi & = 2\pi t\\ x & = r * \cos(\varphi) + c_x \\ y & = r * \sin(\varphi) + c_y\\ z & = c_z \end{align*}

Next up, I created a loxodrome path (hope this is the correct expression), in which the ball moves from one pole of the sphere to the other with a certain number of windings $W$ and jumps to the first pole again after time $T$: \begin{align*} \varphi & = 2\pi t W\\ \theta & = \pi t\\ x & = r * \sin(\theta) * \cos(\varphi) + c_x \\ y & = r * \sin(\theta) + \sin(\varphi) + c_y\\ z & = 2rt - r + c_z \end{align*}

In order to have a continuous path (i.e. from north pole to south pole and back to north pole), I adjusted the values of $\varphi$ and $\theta$ and inserted a conditional statement: \begin{align*} \varphi & = 4\pi t W \\ \theta & = 2\pi t \end{align*} \begin{align*} x & = \begin{cases} r * \sin(\theta) * \cos(\varphi) + c_x &\mbox{if } \varphi < 2\pi W \\ -(r * \sin(\theta) * \cos(\varphi) + c_x) & \mbox{if } \varphi \geq 2\pi W \end{cases} \\ y & = \begin{cases} r * \sin(\theta) * \sin(\varphi) + c_y &\mbox{if } \varphi < 2\pi W \\ -(r * \sin(\theta) * \sin(\varphi) + c_y) & \mbox{if } \varphi \geq 2\pi W \end{cases} \\ z & = \begin{cases} 2r * 2t - r + c_z &\mbox{if } \varphi < 2\pi W \\ -(2r * (2t-1) - r + c_z) & \mbox{if } \varphi \geq 2\pi W \end{cases} \\ \end{align*}

All this works quite well so far. However, I would love to move the ball on different paths on the sphere than those. Unfortunately I'm not really familiar with the exact terminology, so it's kind of hard for me to describe what I'm actually trying to achieve, but I guess I'm looking for something similar to this. There the movement seems to be less regular but you can probably still parameterize it with similar equations to the ones above.

• One approach: Draw a curve in the plane and then use stereographic projection to obtain a corresponding curve on the sphere. See this MSE posting for explicit equations of the plane-to-sphere mapping. – Joseph O'Rourke Dec 23 '14 at 16:05
• Great link, thanks a lot. Seifert's spherical spiral looks really interesting! – Schnigges Dec 23 '14 at 16:48

See also this Mark McClure MO posting for complex closed polygonal paths on a sphere:

Thanks for the answers, in fact the Seiffert spherical spiral was exactly what I was looking for. Depending on two parameters $n$ (number of times the spiral circles the sphere) and $p$ (number of times the spiral passes each pole of the sphere) a value $m$ is calculated as the solution of a transcendental equation containing the elliptic integral of the first kind. Using the value $m$, an optimal length of the curve $s_n$ can be calculated so that the spiral is always a closed curve. For different values of $n$ and $p$, a variety of curves can be described.

Based on the excellent paper from Paul Erdös (click me) I implemented the spiral in C++ and would like to share the equations involved with you.

$$s_n = \frac{2\pi *n}{\sqrt{m}}\\ s = fmod(t * s_n, s_n), t \in [0,1]\\$$

$$x = r * sn * cos(s * \sqrt{m}) + c_x\\ y = r * sn * sin(s * \sqrt{m}) + c_y\\ z = r * cn + c_z\\$$

In this case, $sn$ and $cn$ are the Jacobian elliptic functions calculated using the ALGLIB-library (alglib::jacobianellipticfunctions(s,m,sn,cn,dn,ph)).

As $m$ can only be approximated numerically, I made the effort and calculated it for different pairs of $n$ and $p$ in Matlab:

  // 9. Seiffert's spherical spiral
// General: http://mathworld.wolfram.com/SphericalSpiral.html
// Paper:   http://www-rohan.sdsu.edu/~jmahaffy/courses/s12/math342B/lectures/sources/elliptic_spiral_Earth.pdf
//
// n = number of times the spiral circles the sphere
// p = number of times the spiral passes each pole
// For each pair (n,p) there is a corresponding value m for which the spiral is closed (Eq. 6.5)
//
// Matlab computations of m:
// > syms m;
// > s = '2/pi*sqrt(m)*ellipticK(m)=n/p';
// > result = solve(s);
//
// n = 1    p = 1   m = 0.628414883197145913782519564676;
// n = 1    p = 2   m = 0.22107276332263936440517488381387; // + 2.3405660314251351303594254035983e-33*i
// n = 1    p = 3   m = 0.10514790303836441831858808938143;
// n = 1    p = 4   m = 0.060584548504278861833140256371548;
// n = 1    p = 5   m = 0.039209920362000575089135608697391;
// n = 1    p = 6   m = 0.027395305741455371687473101708187;
// n = 1    p = 7   m = 0.020201239396155198559136549865566;
// n = 1    p = 8   m = 0.015503523874597747452655390792066;
// n = 1    p = 9   m = 0.012269764404208292369458893383901;
// n = 1    p = 10  m = 0.0099501559378538818733218598913546; // + 9.1179018575322532039356074196433e-33*i

    // n = 2    p = 1   m = 0.97184258321949849734943807300197;
// n = 2    p = 2   m = 0.628414883197145913782519564676;
// n = 2    p = 3   m = 0.35823755780404419072770187200723;
// n = 2    p = 4   m = 0.22107276332263936440517488381387; // + 2.3405660314251351303594254035983e-33*i
// n = 2    p = 5   m = 0.14781988915899021141873320537908; // - 3.5295666664425155811008420647959e-33*i
// n = 2    p = 6   m = 0.10514790303836441831858808938143;
// n = 2    p = 7   m = 0.078384331700572164323197919436928;
// n = 2    p = 8   m = 0.060584548504278861833140256371548;
// n = 2    p = 9   m = 0.04818202168469427764270599606717; // - 1.0549110264967422449837206929763e-33*i
// n = 2    p = 10  m = 0.039209920362000575089135608697391;

// n = 3    p = 1   m = 0.99871354720298985489112983129642;
// n = 3    p = 2   m = 0.8835494581224479745120600454009;
// n = 3    p = 3   m = 0.628414883197145913782519564676;
// n = 3    p = 4   m = 0.42917296945496154022127625048127;
// n = 3    p = 5   m = 0.30198626042774115193612827570666;
// n = 3    p = 6   m = 0.22107276332263936440517488381387; // + 2.3405660314251351303594254035983e-33*i
// n = 3    p = 7   m = 0.16773885414526751324895270522922;
// n = 3    p = 8   m = 0.13115979547177802701275086716248;
// n = 3    p = 9   m = 0.10514790303836441831858808938143;
// n = 3    p = 10  m = 0.086061876776353245278269375505017;

// n = 4    p = 1   m = 0.99994421385684002922370980085016;
// n = 4    p = 2   m = 0.97184258321949849734943807300197;
// n = 4    p = 3   m = 0.82192828155150925021774720063324;
// n = 4    p = 4   m = 0.628414883197145913782519564676;
// n = 4    p = 5   m = 0.47128880393801943378767149756164;
// n = 4    p = 6   m = 0.35823755780404419072770187200723;
// n = 4    p = 7   m = 0.27831713623020937941589909953919;
// n = 4    p = 8   m = 0.22107276332263936440517488381387; // + 2.3405660314251351303594254035983e-33*i
// n = 4    p = 9   m = 0.17917939710638224240965537977707;
// n = 4    p = 10  m = 0.14781988915899021141873320537908; // - 3.5295666664425155811008420647959e-33*i

// n = 5    p = 1   m = 0.99999758879809761202850868492667;
// n = 5    p = 2   m = 0.99388201776501371318810849497399;
// n = 5    p = 3   m = 0.92599843158894127000164316820422;
// n = 5    p = 4   m = 0.7826370820421168258370765429255;
// n = 5    p = 5   m = 0.628414883197145913782519564676;
// n = 5    p = 6   m = 0.49893591155189869302612850518628;
// n = 5    p = 7   m = 0.3988043108850326223670178016996;
// n = 5    p = 8   m = 0.32294844872147634539771974371907;
// n = 5    p = 9   m = 0.26533221075339290253862871601258;
// n = 5    p = 10  m = 0.22107276332263936440517488381387; // + 2.3405660314251351303594254035983e-33*i

// n = 6    p = 1   m = 0.99999989580146241539538581537872;
// n = 6    p = 2   m = 0.99871354720298985489112983129642;
// n = 6    p = 3   m = 0.97184258321949849734943807300197;
// n = 6    p = 4   m = 0.8835494581224479745120600454009;
// n = 6    p = 5   m = 0.75615226134522680535921405250161;
// n = 6    p = 6   m = 0.628414883197145913782519564676;
// n = 6    p = 7   m = 0.51840380696315887576206671222707;
// n = 6    p = 8   m = 0.42917296945496154022127625048127;
// n = 6    p = 9   m = 0.35823755780404419072770187200723;
// n = 6    p = 10  m = 0.30198626042774115193612827570666;

// n = 7    p = 1   m = -
// n = 7    p = 2   m = 0.99973182129767497080558223451588;
// n = 7    p = 3   m = 0.98976380740154733918413857655009;
// n = 7    p = 4   m = 0.94151241563784616143441569567489;
// n = 7    p = 5   m = 0.84916367159766343081698912712511;
// n = 7    p = 6   m = 0.737265016843567520368489492179;
// n = 7    p = 7   m = 0.628414883197145913782519564676;
// n = 7    p = 8   m = 0.5328271260532651364589168405851;
// n = 7    p = 9   m = 0.45264912749631033333492533311642;
// n = 7    p = 10  m = 0.38662946505641174889216599267289;

// n = 8    p = 1   m = -
// n = 8    p = 2   m = 0.99994421385684002922370980085016;
// n = 8    p = 3   m = 0.99635525719770974087814912581027;
// n = 8    p = 4   m = 0.97184258321949849734943807300197;
// n = 8    p = 5   m = 0.91101875386783307453869716585274;
// n = 8    p = 6   m = 0.82192828155150925021774720063324;
// n = 8    p = 7   m = 0.72317192825869596875014827208905;
// n = 8    p = 8   m = 0.628414883197145913782519564676;
// n = 8    p = 9   m = 0.54392996654407129573177572095827;
// n = 8    p = 10  m = 0.47128880393801943378767149756164;

// n = 9    p = 1   m = -
// n = 9    p = 2   m = 0.99998840138671573885964551830864;
// n = 9    p = 3   m = 0.99871354720298985489112983129642;
// n = 9    p = 4   m = 0.98678246728516395065439048225706;
// n = 9    p = 5   m = 0.94932829911778459441524725093594;
// n = 9    p = 6   m = 0.8835494581224479745120600454009;
// n = 9    p = 7   m = 0.8002092250295375072494546279764;
// n = 9    p = 8   m = 0.71227478807029666643532866864045;
// n = 9    p = 9   m = 0.628414883197145913782519564676;
// n = 9    p = 10  m = 0.55273497309072066900141457973677;

// n = 10   p = 1   m = -
// n = 10   p = 2   m = 0.99999758879809761202850868492667;
// n = 10   p = 3   m = 0.99954753402276463781698446094983;
// n = 10   p = 4   m = 0.99388201776501371318810849497399;
// n = 10   p = 5   m = 0.97184258321949849734943807300197;
// n = 10   p = 6   m = 0.92599843158894127000164316820422;
// n = 10   p = 7   m = 0.85975155865425048270186903508427;
// n = 10   p = 8   m = 0.7826370820421168258370765429255;
// n = 10   p = 9   m = 0.70360673694439866341722428678946;
// n = 10   p = 10  m = 0.628414883197145913782519564676;

• Share an image, please! :-) – Joseph O'Rourke Dec 24 '14 at 0:20