I have been experimenting with drawing curves on the surface of a sphere (of radius 1). In order for it to lie on the sphere, every point $(x,y,z)$ must satisfy:
$$
\begin{equation} \tag{1} \label{Eq1}
x^2 + y^2 + z^2 = 1
\end{equation}
$$
I became interested in drawing something vaguely resembling the seam on a tennis ball:
My first guess was to try (for some parameter $\theta$ between $0$ and $2\pi$), $x(\theta)=cos(\theta)$ and $y(\theta)=sin(\theta)$, before I realised that's obviously just a circle and from $(\ref{Eq1})$ we get $z(\theta)=0$ (oops). So instead, I replaced $sin(\theta)$ with a triangular wave:
Then, using $(\ref{Eq1})$, I know $z(\theta)$ must satisfy:
$$ \begin{equation} \tag{2} \label{Eq2} z(\theta) = \pm\sqrt{1 - x^2(\theta) - y^2(\theta)} \end{equation} $$
If I just take the positive solution for all $\theta$, then my curve is discontinuous. However, if I alternate + and - (or vice versa) for each of the four quadrants, then I get a nice smooth curve like I want:

However, I can't figure out if there's a neat equation for describing my $z(\theta)$. It doesn't look so complicated in the graph below. Can someone tell me if there's a neat way of describing it (as some function of $\theta$)?
Sorry for the long question and many thanks for your help!

