This post is about two transform pairs of quaternion that reduce the working domain which are not commonly discussed. Specifically they both reduce the implied angle in quaternion space. This allows storing a quaternion value with three elements more attractive, but more importantly reduces the range of the implied angle. This angle reduction can be useful for interpolation, quantization and shaping distributions for example. The usefulness of these maps for quantization and interpolation depend on the target error bound and maximum implied angle the system allows. There are relatively well known techniques which use unit magnitude and that $Q$ and $Q$ are equivalent for alternate storage and/or quantization. I will later examine the case of interpolation and will focus on the basic properties and present some simple quantization.
Once we get past the preliminary junk we’ll be almost entirely talking about a 2D plane and complex numbers. I will also drop most of the formalism. I’m also going to skip on actually defining the sets and will simply note how I name them and they are hopefully obvious by context.
I’m using pseudoGLSL for code snippets in an attempt at clarity. I will make very few nods to optimizations other than carrying through some of the derivations.
Preliminary stuff
We generally work with quaternions $\left(\mathbb{H}\right)$ represented by four real values:
Where I will call “$a$” the scalar part^{1} and $\bvec{x,y,z}$ the bivector part. For our purposes here we can consider a 3D bivector to be equivalent to a 3D vector.
We will also want to express a quaternion in terms of some implied unit bivector $\mathbf{u}$ $\left( \mathbb{S}^{2} \right) $ with implied magnitude $b$:
and in polar form^{2} with an implied angle (measurement in quaternion space) of $\theta$:
Since all nonzero scalar multiples of a quaternion represent the same rotation (projective line^{3} $sQ$, for unit quaternion $Q$ and nonzero scalar $s$) so we can restrict ourselves to unit quaternions. Equation $\eqref{eq:qpolar}$ already makes this assumption. This gives the four dimension unit sphere $\left( \mathbb{S}^{3} \right) $ as a working domain.
The projective line intersects the unitsphere at $Q$ and $Q$, so we can further restrict ourself to quaternions with scalars part that are zero or positive $\left( a \geq 0 \right)$. In axisangle think this is negating the angle and reversing the axis. The reduces the working domain to the half sphere $\left( \mathbb{S}^{3+} \right) $. $ \newcommand{\hcomplex}[1]{\mathbb{C}_{#1}} $ So far all standard fare.
If we take the set of all quaternion with fixed $\mathbf{u}$ definable in forms $\eqref{eq:qsb}~\eqref{eq:qpolar}$ they form a plane which spans the lineofreals and $\mathbf{u}$. This plane forms a commutative subalgebra of $\mathbb{H}$ isomorphic to $\mathbb{C}$, we can denote this plane as $\hcomplex{u}$ or as the {1,Q}plane. The set of all quaternions is the collection of all unique complex planes and they intersect at the line of reals.
The transform pairs which we will be considering are what I call (quaternion valued) complex functions which simply means if we have a function $f$ which given input in some complex plane then the result is in the same complex plane. In other words we are working in two dimensions using the standard set of complex numbers.
We are at the following in terms of $\eqref{eq:qsb}$:
 effectively working with the complex number: $z = a + b~\mathbf{i} $
 unit magnitude: $ a^2 + b^2 =1 $
 positive scalar: $ a $ on $\left[0,1\right] $
 $ b $ on $\left[0,1\right] $, since $b=\sqrt{x^2+y^2+z^2}$. Any sign of $b$ is contained by the implied $\mathbf{u}$
 the implied angle $\theta$ is therefore on $\left[0,~\frac{\pi}{2}\right]$
 the domain is the arc of unit circle in the first quadrant, axes included.
The presented forward transforms are also in the first quadrant, axes included.
Half/double angle
Quaternions naturally contain a halfangle/doubleangle relation. To convert from an axisangle representation we halve the angle of the rotation. If we have a rotation represented in axisangle form with the axis represent by the unit vector $\hat{u}$ and an angle of rotation $\alpha$, then the conversion to quaternions can be expressed as:
where the unit vector $\hat{u}$ and unit bivector $u$ are the same $(x,y,z)$ values. I will from now on use $\alpha$ to indicate an angle measure in 3D and continue to use $\theta$ for in quaternion space with $\theta = \frac{\alpha}{2}$ and $\alpha = 2\theta$ in the standard (untransformed) representation.
In turn this halfangle representation is doubled when we apply the similarity transform^{4} (the rotation matrix conversion is the similarity transform applied to an orthonormal basis).
We can introduce a second halfangle/doubleangle transform pair. In complex number these translate to square root and squaring (or trig identities or geometry). The half angle transform is:
And the doubleangle transform:
Equation $\eqref{zsq}$ is for reconstructing from all four components and $\eqref{zsqBv}$ for when we only have the values of the bivector part.
After the halfangle transform we have:
 $ a^2 + b^2 =1 $
 $\theta \in \left[0,~\frac{\pi}{4}\right]$
 $ a \in \left[\frac{1}{\sqrt{2}},1\right] $
 $ b \in \left[0, \frac{1}{\sqrt{2}}\right] $
 $ a \ge b $
For the complex plane as a whole we are halving the angle with respect to the line of reals and the magnitude is squarerooted. This maps the negative halfplane to the positive. Steven Wittens’ blog post “How to Fold a Julia Fractal” has some handy mathbox visualizations in “Like Hands on a Clock” section. From step 29>30 shows the squareroot (with negative $x$ pointing down).
Remember in the plane all points along the projective line are equivalent. We can think of the projective line as being two halflines on either size of the origin that have an angle of $\pi$ between them. After the halfangle transform these half lines have a relative angle of $\frac{\pi}{2}$ and since nothing has happened to the properties in the plane, so we now have two orthogonal projective lines all of which are equivalent representations. That means four unit quaternions are equivalent. (“Like Hands on a Clock”: step 30>31). When we square again these two images of the projective line become one again.
The halfangle transform does not effect angle measurements between bivectors so we cannot simply treat halfangle representations as the standard and expect everything to work. As an example we cannot simply compose rotations with a product. In this additional halfangle representation then the proper rotation is $ AABB $. If we attempted to compose with product and then square we would have $ ABAB $. I will say more about this in later posts.
Log/exp transform
Another pair of complex functions are $\log$ and $\exp$. For unit quaterions (complex numbers) $\log$ can be expressed in terms of the polar form \eqref{eq:qpolar} as:
which maps a unit quaternion to a bivector. The reverse transform $\exp$ when given a bivector can be expressed as:
which is simply another (and common) way to express the polar form. Notice that $\log$ is implicitly the conversion from an axisangle representation and is sometime called Euler form^{5}. Basically it is simply a connection between the algebra and trig operations. Since we are on a limited range for both transforms we could use a combination of trig identities and function approximation to come up with reasonably accurate and fast versions, however here we are only going to consider these as the “ideal target” transforms since $\log$ perfectly linearizes the angle where we have:
 $ a = 0 $
 $ b \in \left[0, \frac{\pi}{2}\right] $
For the space as a whole we are mapping our 4D unit halfsphere input to a 3D ball with a radius of $\frac{\pi}{2}$.
Cayley transform
The Cayley transform^{6} dates back to the 1840s^{7}. It is a special case of a stereographic projection^{8} and it is a Möbius transformation^{9} (linear fractional transformation). It is also the connection between the Lie algebra and group and is related to tangent halfangle substitution^{10}. Representing rotations as the Cayley transform of unit quaternions is called CayleyKlein parameters^{5}.
If we call the forward transform $f$ and the reverse $g$ then we have:
Expanding the forward transform with $\eqref{eq:qsb}$:
Like $\log$ the result is a bivector. In polar form we have:
We only need the reverse transform for bivector input:
NOTE: In general (since the quaternion product does not commute) division is an ill defined operation. It can mean either a product on the left or right by the inverse. However in this case we have a “complex function” so the product does commute and there is no ambiguity: $\left(Q1\right)\left(Q+1\right)^{1} = \left(Q+1\right)^{1}\left(Q1\right)$. Some text incorrectly state otherwise. I chose the division form since we should be thinking in complex numbers.
After the forward transform we have:
 $ a = 0 $
 $ b \in \left[0, 1\right] $
For the space as a whole we are mapping our 4D unit halfsphere input to the 3D unit ball. If we were to apply the forward transform above to the negative 4D halfsphere it maps to all of the 3D space outside of the unit ball. Inverting the original transforms is the opposite transform pair (negative to unit ball, positive to outside).
Recap and Cayley visualization
The following is a shadertoy to illistrate the Cayley transform and some basic concepts up to this point. It starts paused. Leftmouse down normalizes the direction to the pointer and set $Q$ to that point on the circle/sphere.
Recap
 The plane of the figure is our complex plane $\hcomplex{u}$, with $u$ is in the positive $y$ direction and positive reals in the positive $x$ direction.
 The unit circle is the intersection of the 4D unit sphere with this plane.
 All rotations about $u$ are in this plane.
 The two illustrated points on the circle are two unit quaternions $Q$ and $Q$.
 The point colored blue has a positive or zero scalar part. The one colored red has a negative scalar part.
 They are initially $\pm 1$ so they are in all of the complex planes of the space.
 The line between these points (except the origin) are all equvalient.
 When the blue point is negative in $y$ we are logically working with $u$ instead (our figure is upside down)
Cayley
The forward function $f$ is the stereographic projection from $(1,0)$ onto line $x=0$ ($y$axis). If we mousedown and move in a counterclockwise manner we have a blue line from $(1,0)$ to our blue point. Where the line crosses the $y$ axis is a green point which is $f\left(Q\right)$. These two points meet at $\frac{\pi}{2}$. If we continue on the blue point changes to red and that green point exits the circle. If we repeat this process there is a second blue line through the red point which is $f\left(Q\right)$. (If the two blue or magenta lines aren’t orthogonal it’s me being sloppy in the shader…move the mouse a bit). This second line does not appear at $\pm 1$, artistic choice (the red point is at infinity) or I’m being sloppy with the math in the shader, you choose. As we start to approach $\frac{\pi}{2}$ this second green point appears at the bottom of the screen and enters the circle when the red point changes to blue.
The magenta lines are the sterographic projection $(1,0)$ onto the $y$axis, which are $\frac{1}{f\left(\pm Q\right)}$ respectively. As an aside we have: $f\left(Q\right) = \frac{1}{f\left( Q\right) ^{*}}$
Comparison of mappings
These figures use plotly.js. You can click on the function in the legend to hide/show that plot.
The first figure is a simply comparison of how the magnitude of the bivector behaves with respect to the implied angle. The $x$axis is the normalized angle, so in terms of the represented angle of rotation in 3D we would multiply by $\pi$. The $y$axis is normalized magnitude of bivector (maximum value of $b$ divided out). If we were to put an upper limit on the implied angle then these plots would grow closer to that of $\log$.
The second figure is the same as the first with simply the linear part subtracted out. If we were to put an upper limit on the implied angle then the shape of plots stay pretty much the same.
We can think of the first figure as being plots of cumulative density where the $y$ value is “how many” and the corresponding $x$ is “where”. As an example if we are linearly quantizing ($N$ samples) and examine $x$ at 0.5 then the $y$ value of each plot is a multiplier $m$ and $mN$ is the number of samples on normalized angle range [0, 0.5]. Or examine the $y$ at 0.5 and then $x$ tells us how far along the angle range the first half of samples represents.
By taking the derivative we can examine localized density which gives a much better picture of how samples are distributed across the full range. Like the second figure the shape of the plots do not change much when adding a cap to maximum implied angle.
The density plots show how the representations behaves locally (in the neighboorhood) of a given angle. For quantization if we linearly quantize the magnitude of the bivector these show the distribution of samples.
Since $\log$ perfectly linearizes the angle we have a nice constant value of one and any samples are equidistributed across the range. The untransformed “standard” representation has a high density around zero and approaches zero at $\alpha = \pi$. The “halfangle” slight favors small angles and “Cayley” prefers large angles.
To be able to “eyeball” how density values change if you place a cap on maximum angle the following show how the untransformed range behaves. Notice the values at .5 vs the endpoints of “halfangle” above. And the “half/half” and “half/Cayley” plots are more to give a feel for evolution of density than to suggest actual usage.
The “takeaway” from these should indicate that the “ideal” situation is not use a transform for quantization. The better solution in terms of minimizing quantization error is to have good context, prediction/deadreckoning and store/transmit relative quaternions which are composed.
Bivector part
None of these transforms effect the implied unit bivector $u$. Accounting for symmetry we can consider the unit bivector $u = \bvec{x,y,z}$ where $x\geq y\geq z \geq 0$, then we have:
so the largest magnitude part of the bivector has the smallest range ($1\frac{1}{\sqrt{3}} \approx 0.42265$)
References and Footnotes

scalar locally just means a real value more generally its the working base field. ↩

Some text prefer $e^{u\theta} $. ↩

Quaternion rotation visualization: (local post) ↩

“Euler form” and “CayleyKlein parameters” are often grouped with “Euler angle” like representations, but the later are totally adhoc systems and the former are not. ↩ ↩^{2}

“Sur quelques propriétés des déterminants gauches.” Journal für die reine und angewandte Mathematik 32, 1846, Arthur Cayley. Reproduced in “The collected mathematical papers of Arthur Cayley, Volume 1”, 1889. ↩