Although these can be used for maps between the surfaces the intended purpose is mapping the volume. I’ll make no comments on reductions for that case. This is going to be even terser than the square/disc post and I’ll skip on things like showing the Jacobian and comments about adding bias to remove degenerate regions (or even that they exist).

I will use the convention that $ \left(x,~y,~z\right)$ is a coordinate in the cube and $ \left(u,~v,~w \right)$ a coordinate in the ball.

In this post I’ll normalize the volume distortion values for the plots. The volume of cube is eight, the ball is $\frac{4}{3}\pi$, the Jacobian determine is multiplied by $\frac{6}{\pi}$ so the value of equal volume is one.

Define a signum like function:

\[\text{sgn}\left(x\right) = \begin{cases} 1 & x \geq 0 \\[2ex] -1 & x < 0 \end{cases}\]Proof-of-concept C code here.

## Radial Stretching cube/ball

As with square/disc the most straight forward map is *radial stretch*. Cube to ball:

The Jacobian determinate:

The volume distortion (determinate multiplied by $\frac{6}{\pi}$):

Ball to cube:

## Fong cube/ball

Fong^{1} derives a number of 3D blending equations as an extension of his 2D work.

One of which is a cube to ball:

\[\left( u,~v,~w \right) = \frac{\sqrt{x^2+y^2+z^2-\left(x^2y^2+y^2z^2+x^2z^2\right)+x^2 y^2 z^2}}{\sqrt{x^2+y^2+z^2}}\left(x,~y,~z\right)\]

We could rewrite the numerator a couple of way that drops the additional products to three. The Jacobian determinate:

The volume distortion:

Fong derives the ball to cube map, however it involves solving a cubic so I’ll give it a pass for now.

## Nowell cube/ball

Nowell in a blog post^{2} presented a cube to ball map:

The volume distortion:

As far as I know nobody has bothered to derive the inverse function^{3}. The density distribution could make worthwhile to solve at some point, but not today.

## Volume preserving cylinder/ball bi-Lipschitz

A paper from 2008 ^{4} derives a volume preserving cylinder to ball map (generalized to $n$-dimensions).

The volume preserving map of cylinder $\left(a,b,z\right)$ with $z \in \left[-1,1\right]$ and a radius of one to ball:

\[\left( u,~v,~w \right) = \begin{cases} \left(a \sqrt{\frac{2}{3}-\frac{a^2+b^2}{9 z^2}}, b \sqrt{\frac{2}{3}-\frac{a^2+b^2}{9 z^2}}, z-\frac{a^2+b^2}{3 z} \right) & z^2 \geq a^2+b^2 \\[2ex] \left(a \sqrt{1-\frac{4 z^2}{9 \left(a^2+b^2\right)}}, b \sqrt{1-\frac{4 z^2}{9 \left(a^2+b^2\right)}}, \frac{2}{3}z \right) & z^2 \leq a^2+b^2 \end{cases}\]

The cases correspond to points inside and outside of the embedded conic respectively.

The ball to cylinder map into two steps. First a common term $t$, a scale factor $s$ and compute $z$:

Then the cylinder can be expressed as:

## As many cube/cylinder/ball maps as you can shake a disc at

Given the volume preserving cylinder/ball map (let’s call it $L$ and its inverse $L^{-1}$) we can construct a cube/ball from any square/disc mapping. If $D$ is a square to disc map and $D^{-1}$ the inverse, then the cube to ball map is:

And the ball to cube map:

The volume distortion of the resulting map is simply (rescaled) area distortion of $D$ for all $z$ slices since $L$ preserves volume. I won’t bother with any more equations. Although redundant I will show the volume distortions for the various disc methods. The gradients are not ideal since these are not mapping one to white, but they all consistent.

### Volume preserving cube/ball

The same paper as cylinder/ball gives the concentric disc method to complete a volume preserving cube/ball map.

### Approximate volume preserving

### Disc radial stretch

### Disc squircle

### Disc elliptical