% This picture represents the fact that geodesics locally minimize distances
% Copyright Pablo (C) 2021
\begin{tikzpicture}[scale=0.5]
  % The cirference
  \draw (0, 0) circle (3);

  % The equator
  \begin{scope}
    \clip (-3, 0) rectangle (3, -3);
    \draw ellipse (3 and 1);
  \end{scope}

  % Greenwhich
  \begin{scope}
    \clip (-3, -3) rectangle (0, 3);
    \draw ellipse (1 and 3);
  \end{scope}

  % The curve
  \begin{scope}
    \clip (-3, 0) rectangle (0, -3);
    \draw[thick, color=violet] ellipse (1 and 3);
  \end{scope}
  \begin{scope}
    \clip (3, -3) rectangle (0, 3);
    \draw[thick, dotted, color=violet] ellipse (1 and 3);
  \end{scope}

  % The ends
  \filldraw (0, 3) circle (2pt) (-1, 0) circle (2pt);

  \draw (-0.87, -1.5) circle (0.3);
  \draw (-1.17, -1.5) -- (-4, 1);

  % Zoom in ares
  \begin{scope}[shift={(-6, 1)}]
    \draw (0, 0) circle (2);

    % The geodesic
    \draw[thick, color=violet] (0, -2) -- (0, 2);
    \filldraw (0, -2) circle (2pt) (0, 2) circle (2pt);

    % Another curve
    \draw[dotted] (   0,    2) to[out=180, in=90] 
                  (-0.6,  1.4) to[out=270, in=150] 
                  ( 0.5,  0.7) to[out=-30, in=0] 
                  ( 0.3,  0.1) to[out=180, in=180] 
                  ( 0.5,  0.6) to[out=0, in=120] 
                  ( 1.3,  0.7) to[out=-60, in=60] 
                  ( 0.4, -0.5) to[out=240, in=90] 
                  (   0,   -2);
  \end{scope}
\end{tikzpicture}

