# mathr / blog / #

## Möbius transformations and the Riemann sphere

This blog post is about two separate things, but both involve Möebius transformations so I combined them into one.

Rotations of the Riemann sphere correspond to those elliptic Möebius transformations whose fixed points are antipodal. Suppose we have two vectors $$u, v \in \mathbb{R}^3$$ with $$|u| = |v| = 1$$ and we want to find the Möebius transformation for the corresponding rotation of the Riemann sphere that takes $$u$$ to $$v$$ in the shortest way. This rotation has fixed points $$w_\pm = \pm \frac{u \times v}{| u \times v |}$$. By stereographic projection these become the fixed points of the Möebius transformation: $$g = \frac{w_x + i w_y}{1 - w_z}$$ for each $$\pm$$. Further, the elliptic transformation has characteristic constant $$k = e^{i \theta} = \cos \theta + i \sin \theta = u \cdot v + i |u \times v|$$ from all of which the transformation is:

$M_{u \to v} = \begin{pmatrix} g_+ - k g_- & (k - 1) g_+ g_- \\ 1 - k & k g_+ - g_- \end{pmatrix}$

If instead of vectors we wanted to rotate between complex numbers, just use stereographic unprojection to get the 3D coordinates and proceed as before: $$\frac{(2x, 2y, x^2+y^2-1)}{x^2+y^2+1}$$. (Note: there may be a sign issue with the $$\sin \theta$$ calculation, in my use case I didn't need to worry about it as all the issues cancelled each other out.)

Bézier curves are useful for generating smooth curves when only linear interpolation is available (the De Casteljau's algorithm construction works by repeated linear interpolation). Linear interpolation for Möebius transformations involves 2x2 complex matrix diagonalisation for raising to fractional powers (between 0 and 1). I wrote about this in more detail in my 2015 blog post interpolating Möebius transformations.

A C1-continuous (but not C2-continuous at the join points) piecewise cubic Bézier spline can be defined by specifying the points (Möebius transformations) $$P_i$$ through which the curve passes, and the tangent $$T_i$$ at each point. Then the pieces of the spline are defined by control points $$(P_i, P_i T_i, T_{i+1}^{-1} P_{i+1}, P_{i+1})$$. The tangents $$T_i$$ might be "small" for smoother results, for example these can be constructed by linearly interpolating between the identity (with large weight) and an arbitrary transform (with small weight). This interpolation scheme gives visually much more sensible results than naive Catmull-Rom spline interpolation between each individual coefficient components separately, while still maintaining smoothness.