This note is for some auxilary information on some maps between the disc and square. A fair amount of the math is convered by Fong^{1} ^{2} and the survey by Lambers^{3}. Specifically this contains:
 A pair of animated plots between the various maps
 Show the Jacobian matrices and determinates and visualize with interactive plots
 Reduced complexity radial stretch in both directions
 Reduced complexity concentric disc to square
 Show a (perhaps) new radial approximate area preserving map
I will use the convention that $ \left(x,~y \right)$ is a coordinate on the square and $ \left(u,~v \right)$ a coordinate on the disc.
Define a signum like function:
Area distortion
This shadertoy is intended to visualize how shapes and angles are transformed under the various maps. Clicking through to the site allows interactivity.
Point set
As an alternate visualization this plot take uniform points on the square and shows how the various square to disc mappings transform the point set.
Radial Stretching
Simplest square to disc map is to simply stretch (scale factor of $L_1$ over $L_2$ norm):
Fong followed by Lambers provide an alternate formulation intended to be computationally friendly. Note that we can reformulate the scale factor $s$ applied to the input coordinate as the following pseudocode:
where $\text{epsilon}$ is some sufficiently small constant^{4}. Formulated in this manner only needs a single select/cmov like operation and no branching to handle all cases including degenerate.
A method to measure area distortion (growth/shrinkage) at infinitesimal around a point is to compute the Jacobian determinate^{5} of the function.
First we need the Jacobian, for $x^2 > y^2$:
and for $x^2 \leq y^2$
The determinates of these are respectively:
Combining these into a single expression gives:
The area of the square is 4 and that of the disc is $\pi$, so the value where no area distortion occurs is $\frac{\pi}{4} \approx 0.785398$. Larger/smaller values are the local stretch/compressing respectively. The plot of the area distortion (determinate):
The disc to square transform is simply inverting the scale factor:
and like above all cases can be handled with no branches and a single select.
Concentric
Peter Shirley and Kenneth Chiu in 1997^{6} derived an area preserving map between square to disc.
The square to disc map as given in Shirley’s blog post^{7} (modifications noted by Dave Cline):
Phase shift and pulling out signs:
The more interesting form will be architecture/code specific. The second form trig inputs are on $\pm\frac{\pi}{4}$, so the cosine terms are always positive and removable without sign fixup and a narrow enough range for light weight approximation.
The Jacobian for $\abs{x} \geq \abs{y}$:
The Jacobian for $\abs{x} < \abs{y}$:
The determinant of both are constant $\left(\frac{\pi}{4} \right)$ as expected for an area preserving map.
The disc to square map:
Where $\text{atan}$ is single parameter. This is degenerate when $v$ is approaching zero. This could be corrected by a select or since $\text{atan}$ is an odd function one possible rewrite choice is:
In either case the range of $\text{atan}$ in on $\pm 1$ so can be lightweight (for it) approximated. ($\epsilon$ is some small constant^{4} as above)
F.G. Squircle
Fong^{1} derivated mappings based on FernandezGuasti’s squircle.
The Jacobian:
The Jacobian determinate:
the plot of the area distortion (determinate):
The disc to square map:
Elliptical
The square to disc mapping was derived by Nowell in a blog post^{8}:
The Jacobian:
The Jacobian determinate:
the plot of the area distortion (determinate):
Fong^{1} provides two derivations of the inverse map, one of which:
where:
Approximate equal area
I haven’t been able to find this method referenced anywhere and a twitter query came up negative as well.
The basic idea here is to form a low complexity middle ground between radial stretch and concentric. See the point set animation above. As such it is only of interest if computationally cheaper than concentric and higher performance is a priority.
The disc to square map:
The square to disc map:
Which is degenerate when $y \le x $ and $y$ approaching zero. Since the division term is positive we can simply add a bias as before. More likely to be interesting is we can multiply through by the denominator and get:
or leave the half inside:
The Jacobian for $\abs{x} \geq \abs{y}$:
and the determinate:
The Jacobian for $\abs{x} < \abs{y}$:
and the determinate:
and the heat map of area distortion. Recall equal area value is $\frac{\pi}{4} \approx 0.785398$
Approximate area preserving (variant 2)
In another post^{9} we have a volume preserving map between cylinder and sphere which breaks the space into two parts: point inside and outside of the embedded conic. We can take a planar slice through the cylinder’s axis to form a square to disc map. Reducing the 3D equation to the slice gives:
We can rewrite the $x^2 \geq y^2$ case to eliminate division (which can be zero) as:
and reexpress the $x^2<y^2$ case as:
The Jacobian for for the cases are:
with the determinates:
The area distortion:
For the disc to square map, start with a common term:
then the map is:
References and Footnotes

“Analytical Methods for Squaring the Disc”, Chamberlain Fong, 2015. (PDF) ↩ ↩^{2} ↩^{3}

“Analytical Methods for Squaring the Disc (presentation slides)”, Chamberlain Fong, 2014. (link) ↩

“Mappings between Sphere, Disc, and Square”, Martin Lambers, 2016. (link) ↩

A reasonable(ish) epsilon for the funcs here under generic usage is the smallest normal fp value (single: $2^{126}$). ↩ ↩^{2}

“A Low Distortion Map Between Disk and Square”, Peter Shirley, Kenneth Chiu, 1997. (PDF) ↩

“Improved code for concentric map”, Peter Shirley’s blog, 2011. (link) ↩

“Mapping a Square to a Circle”, Philip Nowell, 2005. (link) ↩