# Homeomorphisms Between the Circular Disc and the Square

Living reference work entry

## Abstract

The circle and the square are among the most common shapes used by mankind. Consequently, it is worthwhile to study the mathematical correspondence between the two. This chapter discusses three different ways of mapping a circular region to a square region and vice versa. Each of these mappings has nice closed-form invertible equations and different interesting properties. In addition, this chapter will present artistic applications of these mappings such as converting the Poincaré disk to a square as well as molding rectangular artworks into oval-shaped ones.

## Keywords

Conformal square Escheresque artworks Invertible mappings Non-Euclidean geometry Poincaré disk squircles

## Introduction

In topology, a homeomorphism is equivalence relation between two geometric objects that can be continuously deformed into one another. Two objects are homeomorphic if there is a continuous invertible mapping between them. An opt-repeated humorous example of this is the homeomorphism between the donut and the coffee cup. Joking aside, a coffee cup is not at all easy to define mathematically. Instead, this chapter will focus on two objects that are simple and well-defined mathematically – namely, the circular disc and the square. We shall study ways to map the circular disc to a square region and vice versa (Fig. 1). Fig. 1A chessboard mapped to a circular disc

Needless to say, there are infinitely many ways to map a circular disc to a square. Of particular interest to us are mappings with nice closed-form invertible equations. This chapter will discuss three such mappings. In addition, this chapter will also introduce and discuss different curious properties of these mappings. These properties include concepts such as uniform grids, radial constraints, and conformality. But before we proceed, this is an important lingering issue that needs to be addressed. This mathematical problem sounds all too familiar. Are we dealing with a classic problem in mathematics? Is this problem just “squaring the circle” under a modern guise?

Indeed, there is a famous classic problem in mathematics called “squaring the circle.” This well-known geometric construction problem involves using a straightedge and a compass to produce a circle and square with equal area. At first glance, our mapping problem seems similar to “squaring the circle.” However, the two problems are only superficially alike and ultimately quite different. Our mapping problem involves finding two-dimensional mapping equations that a computer can calculate, whereas the classic problem has to do with geometric construction using a draftsman’s tools.

## Canonical Mapping Space

In order to mathematically describe the mappings, we need to first cover notation and introduce some variables in the canonical mapping space. For the mappings, the domain is the unit disc centered at the origin, and the range is the square with corners at (±1, ±1). This is shown in Fig. 2. We shall denote (u, v) as a point contained in the unit disc and (x, y) as the corresponding point contained in the square after the mapping. Fig. 2Canonical mapping space for the circular disc and the square

Mathematically speaking, we want to find functions f that maps every point (u, v) in the circular disc to a point (x, y) in the square region and vice versa. In others word, we want to derive equations for f such that (u, v) = f(x, y) and (x, y) = f−1(u, v).

## Mapping Diagram with Equations

Figure 3 shows the three mappings that are at the core of this chapter. These are the Tapered2 Squircular, Elliptical Grid, and the Conformal Square mapping. In order to illustrate the visual properties of these mappings, there are diagrams for a disc with a radial grid converted to a square. These appear on the left side of Fig. 3. Similarly, on the right side, there are diagrams for a rectilinear square grid converted to a circular disc. Each of these mappings has corresponding forward and inverse equations accompanying the diagrams. From here, one can observe that these equations come in varying degrees of mathematical sophistication. Fig. 3Some mappings to convert a disc to a square and vice versa

For the Tapered2 Squircular mapping, it is convenient to use vector notation. In contrast, for the Conformal Square mapping, it is most appropriate to use complex numbers to come up with relatively compact equations. On the other hand, the Elliptical Grid mapping can be expressed simply by using plain algebraic equations. Each of these mappings will be discussed in more detail in the next section.

It is important to review the signum function at this point. This function is abbreviated as sgn(x) and is defined as
\displaystyle \begin{aligned} sgn(x) = \left\{ \begin{array}{l} -1 \;\;\;\;\; if \;\; x < 0 \\ \;\;\;0 \;\;\;\;\;\; if \;\; x = 0 \\ \;\;\;1 \;\;\;\;\;\; if \;\; x > 0 \end{array} \right. \end{aligned}

## Some Mathematical Details

### Fernandez-Guasti Squircle

In 1992, Manuel Fernandez-Guasti discovered a plane algebraic curve that is an intermediate shape between the circle and the square (Fernandez-Guasti, 1992). His curve is represented by a quartic equation.
\displaystyle \begin{aligned} x^2 + y^2 -\frac{s^2}{r^2}x^2 y^2 = r^2 \end{aligned}
(1)
His equation includes a parameter s that can be used to blend between the circle and the square smoothly. Figure 4 illustrates the Fernandez-Guasti squircle at varying values of s. Fig. 4The Fernandez-Guasti squircle at varying squareness

The squareness parameter s can have any value between 0 and 1. When s = 0, the equation produces a circle with radius r. When s = 1, the equation produces a square with side length 2r. In between, the equation produces a smooth curve that is a geometric hybrid of the circle and the square.

### Tapered2 Squircular Mapping

The Fernandez-Guasti squircle can be used as groundwork for creating mappings between the circular disc and the square. The key idea is to match circular contours inside the circular disc to squircular contours inside the square. This is shown in Fig. 5. Fig. 5Mapping based on the squircular continuum

A circular disc can be considered as a continuum of concentric circles. Likewise, a square region can be considered as a continuum of concentric squircles with increasing squareness. These concentric squircles become increasingly square-like as they approach the bounding rim. We shall denote this phenomena as the squircular continuum of the square.

In addition to matching contours inside the circular disc and the square, the Tapered2 Squircular mapping has a restriction called the radial constraint. In a nutshell, this means that points are only allowed to move radially during the mapping process. This is illustrated in Fig. 6. Fig. 6Radial constraint on the mapping

By coupling the radial constraint with a nonlinear squircular continuum, it is possible to derive a set of equations for mapping the circular disc to a square. This is a geometric overview of how the Tapered2 Squircular mapping was derived. For more details, see Fong (2019).

The mapping equations provided in Fig. 3 are not exactly precise. In the interest of brevity, some important details were intentionally left out. For example, in the square-to-disc mapping equation, there are degenerate points that cause a division by zero. These degenerate points are located at the center and the four corners of the square. At these locations, the mapping equation results in the indeterminate form $$\frac {0}{0}$$. However, the limiting value of the mapping for these points is well-defined.

In view of these and other missing details, here are the amended mapping equations for the Tapered2 Squircular mapping.
$$\left[ \begin{array}{cc} x \\ y \end{array} \right] = \left\{ \begin{array}{lll} sgn(uv) \sqrt{\frac{-u^2-v^2+\sqrt{(u^2+v^2)[u^2+v^2+4u^2v^2(u^2+v^2-2)]}}{2(u^2+v^2-2)}} \left[ \begin{array}{lll} \frac{1}{u} \\ \frac{1}{v} \end{array} \right] \qquad if \; \begin{array}{c} u \neq 0 \\ v \neq 0 \end{array} \\ \left[\begin{array}{c} u \\ v \end{array} \right] \qquad\qquad\qquad\qquad \mathit{otherwise} \end{array} \right.$$
$$\left[ {\begin{array}{*{20}{c}} u \\ v \end{array}} \right] = \left\{ {\begin{array}{*{20}{c}} {\sqrt {\frac{{{x^2} + {y^2} - 2{x^2}{y^2}}}{{({x^2} + {y^2})(1 - {x^2}{y^2})}}} \left[ {\begin{array}{*{20}{c}} x \\ y \end{array}} \right]} \\ {\left[ {\begin{array}{*{20}{c}} {\operatorname{sgn} (x)\frac{1}{2}\sqrt 2 } \\ {\operatorname{sgn} (y)\frac{1}{2}\sqrt 2 } \end{array}} \right]} \\ {\left[ {\begin{array}{*{20}{c}} 0 \\ 0 \end{array}} \right]} \end{array}\begin{array}{*{20}{c}} {\qquad if\begin{array}{*{20}{c}} {(x,y) \ne (0,0)} \\ {(x,y) \ne ( \pm 1, \pm 1} \end{array}} \\ {\qquad if(x,y) = ( \pm 1, \pm 1)} \\ {\qquad if(x,y) = (0,0)} \end{array}} \right\}$$

### Lamé Squircle

The Fernandez-Guasti squircle is by no means the only shape that is a parameterized hybrid of the circle and square. In fact, there is a much more famous curve known as the superellipse that also has this property. The Lamé squircle is a special case of the superellipse with no eccentricity. This plane algebraic curve was originally studied by Gabriel Lamé in 1818. Qualitatively, the curve appears very similar to the Fernandez-Guasti squircle, but there are several important differences which will be discussed later. The Lamé squircle has the equation
\displaystyle \begin{aligned} |x|{}^p + |y|{}^p = r^p \end{aligned}
(2)
There are two parameters in this equation: p and r. The power parameter p allows the shape to interpolate between the circle and the square. When p = 2, the equation produces a circle with radius r. As p →, the equation produces a square with a side length of 2r. In between, the equation produces a smooth planar curve that resembles both the circle and the square. Figure 7 shows the Lamé curve at increasing powers. Fig. 7Lamé squircle at varying polynomial powers

Although the Lamé squircle exhibits qualitative similarities with the Fernandez-Guasti squircle, there is a major difference between the two. The Lamé squircle can only approximate the square. It requires an infinite exponent in order to fully realize the square. Moreover, since the polynomial equation for the Lamé curve has unbounded exponents, it is unwieldy and difficult to manipulate algebraically. Nevertheless, the Lamé squircle can be used as groundwork for devising another disc-to-square mapping.

The Lamé squircle has a parametric form in which x and y coordinates of points on the curve can be specified in terms of parameter t. The parametric equations are
\displaystyle \begin{aligned} \begin{array}{rcl} x(t) = sgn( \cos{t}) \; |\cos{t}|{}^{\frac{2}{p}} \\ y(t) = sgn( \sin{t}) \; |\sin{t}|{}^{\frac{2}{p}} \end{array} \end{aligned}
(3)
Using these parametric equations of the Lamé squircle, it is possible to devise another disc-to-square mapping. The key idea is to make the substitutions $$\mathbf {u=\cos {t}}$$ and $$\mathbf {v=\sin {t}}$$ to represent points in the circular disc. This mapping is shown in Fig. 8 with corresponding equations as
\displaystyle \begin{aligned} \begin{array}{rcl} x = sgn(u) \; |u|{}^{1-u^2-v^2} \\ y = sgn(v) \; |v|{}^{1-u^2-v^2} \end{array} \end{aligned}
(4)

This mapping based on the Lamé squircle has several undesirable properties that make it less useful than the other mappings shown in Fig. 3. For one thing, explicit inverse equations are not provided. It is quite likely that there are no closed-form equations for expressing the inverse mapping. This means that the inverse mapping can only be computed using iterative root-solving techniques in numerical analysis.

Another egregious property of this mapping is that it only works on the open circular disc and the open square region. This means that mapping does not include the circular boundary of the disc or the rim of the square region. Mathematically, the domain of the mapping is the open circular disc {(u, v)|u2 + v2 < 1}, and the range of the mapping is the (−1, 1) × (−1, 1) open square region.

### Elliptical Grid Mapping

The square can easily be subdivided into a grid of smaller squares. In stark contrast, there is no easy way to subdivide the circle into a grid of smaller nonoverlapping circles. Nevertheless, the circular disc can be subdivided into a uniform grid based on elliptical arcs. This is shown on the right of Fig. 9. Using this observation, it is possible to devise a square-to-disc mapping. The key idea is to match cells inside the square grid with cells inside the circular grid. Fig. 9Overview of the Elliptical Grid mapping
In 2005, Philip Nowell (2005) came up with very simple equations for mapping a square to a circular disc. The derivation basically boils down to two mathematical constraints needed to match square cells with elliptical grid cells. The first constraint comes from matching vertical line segments inside the square to vertically oriented elliptical arcs inside the circular disc. This is illustrated in Fig. 10 where a vertical line and its corresponding elliptical arc are shown in red. This mapping relationship can be summarized by the equation:
\displaystyle \begin{aligned} 1 = \frac{u^2}{x^2} + \frac{v^2}{2-x^2} \end{aligned}
(5)

Essentially, for each vertical line segment of constant x inside the square, there is a corresponding equation of an ellipse centered in the circle. The bounds, eccentricity, and semi-major and semi-minor axial lengths of this ellipse vary depending on the value of x. Specifically, the left and right vertex tips of the ellipse follow the value of x. Meanwhile, the top and bottom vertex tips vary as $$\pm \sqrt {2-x^2}$$.

The second constraint of the mapping comes from matching horizontal line segments inside the square to sideway-oriented elliptical arcs inside the circular disc. This is illustrated in Fig. 11 where a horizontal line and its corresponding elliptical arc are shown in red. This mapping relationship can also be summarized by the equation:
\displaystyle \begin{aligned} 1 = \frac{u^2}{2-y^2} + \frac{v^2}{y^2} \end{aligned}
(6)

Essentially, for each horizontal line segment of constant y in the square, there is a corresponding equation of an ellipse centered in the circle. The bounds, eccentricity, and semi-major and semi-minor axial lengths of this ellipse vary depending on the value of y. Specifically, the top and bottom vertex tips of the ellipse follow the value of y. Meanwhile, the left and right vertex tips vary as $$\pm \sqrt {2-y^2}$$.

Basically, the mapping assigns the grid of perpendicular vertical and horizontal lines inside the square to a grid of elliptical arcs inside the circular disc. As shown in Fig. 9, this is essentially matching square grid cells with elliptical grid cells . A curvilinear grid of elliptical arcs can be formed by superimposing the vertically oriented and horizontally oriented elliptical arcs inside the circular disc. Figure 12 shows the resulting curvilinear grid resulting from the superimposition. Fig. 12Superimposing the vertical and horizontal arcs to create a curvilinear elliptical grid

Note that the ellipses get more and more eccentric as x or y approach zero. Also, the ellipses get more circular as x or y approach ± 1.

Mathematically, we can mix the vertical constraint equation with the horizontal constraint equation to get algebraic expressions for u and v in terms of x and y. This can be done by starting with the vertical constraint equation and doing some algebraic manipulations to isolate u2.
\displaystyle \begin{aligned} \begin{array}{rcl} 1 = \frac{u^2}{x^2} + \frac{v^2}{2-x^2} \;\;\;\Longrightarrow\;\;\; 1 - \frac{v^2}{2-x^2} = \frac{u^2}{x^2} \;\;\;\Longrightarrow\;\;\; u^2 = x^2 \left(1 - \frac{v^2}{2-x^2}\right) \end{array} \end{aligned}
We can then plug this u2 value into the horizontal constraint equation
\displaystyle \begin{aligned} \begin{array}{rcl} 1 = \frac{u^2}{2-y^2} + \frac{v^2}{y^2} \;\;\;\Longrightarrow\;\;\; 1 = \frac{x^2\left(1 - \frac{v^2}{2-x^2}\right)}{2-y^2} + \frac{v^2}{y^2} \end{array} \end{aligned}
Multiply both sides of the equation by (2 − x2)(2 − y2)y2 to remove fractions and get
\displaystyle \begin{aligned} \begin{array}{rcl} (2-x^2)(2-y^2)y^2 = x^2 y^2 (2-x^2 - v^2) + v^2(2-x^2)(2-y^2) \end{array} \end{aligned}
After which, one can isolate v2 into one side of the equation
\displaystyle \begin{aligned} \begin{array}{rcl} (2-x^2)(2-y^2)y^2 - x^2 y^2 (2-x^2) = -x^2 y^2 v ^2 + (2-x^2)(2-y^2)v^2 \;\;\;\Longrightarrow \\ v^2 (2-x^2)(2-y^2 - x^2 y^2) = (2-x^2)y^2(2-y^2-x^2) \;\;\;\Longrightarrow \\ v^2 = y^2 \frac{(2-x^2)(2-y^2-x^2)}{(2-x^2)(2-y^2)-x^2y^2} \;\;\;\Longrightarrow\;\; \\ v^2 = y^2 \frac{(2-x^2)(2-y^2-x^2)}{4-2x^2-2y^2} = y^2 \frac{2-x^2}{2} \;\;\;\Longrightarrow \\ v = y \sqrt{\frac{2-x^2}{2}} \;\;\Longrightarrow\;\; \mathbf{v = y \sqrt{1-\frac{x^2}{2}}} \end{array} \end{aligned}
Similarly, in a symmetric fashion, one can solve for u as
\displaystyle \begin{aligned} \begin{array}{rcl} \mathbf{u = x \sqrt{1-\frac{y^2}{2}}} \end{array} \end{aligned}

It is also possible to derive the inverse equations for this mapping, but the algebraic manipulation needed is much more elaborate. Instead, we refer the reader to Fong (2014) for a lengthy derivation of denested inverse equations.

### Conformal Square Mapping via Schwarz-Christoffel

A conformal mapis a mapping that preserves angles between geometric features after the mapping operation is performed. In other words, a conformal mapping does not distort angles. This section will discuss a disc-to-square mapping that is conformal. However, in order to do this, we need to take a small detour through the complex plane beforehand and discuss some theory first.

One of the most celebrated results in nineteenth-century complex analysis is the Riemann mapping theorem (Frederick and Schwarz, 1990). It states that there exists a conformal map between the open unit disc and every simply connected subset of the complex plane. Moreover, it states that this conformal map is unique if we fix a point and the orientation of the mapping. In theory, the Riemann mapping theorem is nice, but it is only an existence theorem. It does not specify how to find the conformal mapping. The next important breakthrough came with the works of Hermann Schwarz and Elwin Christoffel. In the 1860s, Schwarz and Christoffel independently developed a formula for a conformal mapping between the unit disc and simple polygonal regions in the complex plane. The formula is complicated and involves an integral in the complex plane.

In order to show how complicated this formula is, it is listed below in its full glory. We will not bother explaining what each of the variables mean in the complex integral. It is suffice to say that the general Schwarz-Christoffel formula is quite complicated.
\displaystyle \begin{aligned} f(z) = \int^z \; \prod_{k=1}^{n} \left(1-\frac{\zeta}{z_k}\right)^{\alpha_k-1} \; d\zeta \end{aligned}
(7)

Furthermore, for most polygons, the integral can only be approximated numerically. Fortunately, for the special case of the square, the Schwarz-Christoffel formula can be reduced to an explicit analytical expression involving complex-valued elliptic integrals and elliptic functions (Langer and Singer, 2011).

#### Legendre Elliptic Integrals

It is appropriate to make a segue here and briefly discuss elliptic integrals and elliptic functions. Of particular interest to us are Legendre elliptic integralsand Jacobi elliptic functions. Specifically, we are interested in the incomplete Legendre elliptic integral of the first kind called F and its closely related inverse function, the Jacobi elliptic function cn.

Mathematically, the incomplete Legendre elliptic integralof the first kind is a two-parameter function defined as
\displaystyle \begin{aligned} F(\phi,k) = \int_0^\phi \; \frac{1}{\sqrt{1-k^2 sin^2 (t)}} \, dt \end{aligned}
(8)

Note that this integral cannot be simplified using any of the standard techniques covered in freshman calculus classes. This integral was originally studied in the context of measuring the arc length of an ellipse. That is the reason why it is called an elliptic integral (Rice and Brown, 2012).

The two arguments provided with this function are also intimately tied to the ellipse. The first parameter ϕ is some sort of angular parameter. It originates from the angle subtended by an arc of the ellipse. The second parameter k is closely related to the eccentricity of the ellipse.

Meanwhile, the Jacobi elliptic function cn can be considered as some sort of inverse to F. Mathematically, it is related to F by the following equation:
\displaystyle \begin{aligned} cn(\eta,k) = \mathrm{cos}(F^{-1}(\eta,k)) \end{aligned}
(9)

#### A Fundamental Conformal Map

Without getting into the nitty-gritty details of the Schwarz-Christoffel mapping, Fig. 13 shows a fundamental conformal map between the circular disc and the square in the complex plane. This mapping can be derived by simplifying the Schwarz-Christoffel integral for the square and using the doubly periodic nature of the Jacobi elliptic function cn on the complex plane. In essence, one could map every point inside the unit disc to a square region conformally by just an evaluation of the complex-valued Jacobi elliptic function cn. Furthermore, the inverse of the mapping can be calculated using the incomplete Legendre elliptic integral of the first kind F. Fig. 13A conformal map between the disc and square in the complex plane

#### Canonical Alignment

The main drawback of the diagram on the complex plane is that the x and y coordinates are not in the canonical mapping space. Figure 13 shows a square with corner coordinates in terms of a constant Ke instead of the ± 1 that is desired. Moreover, the square is tilted by 45 and off-center from the origin. In order to get this mapping into the canonical mapping space, one needs to perform a series of affine transformations on the square. These include centering the square to the origin and scaling it down to have a side length value of 2. In order to do this, one has to introduce a rotational factor for the 45 tilt as well as Ke offsets and scale factors. This is exactly what happens in the explicit equations for the Conformal Square mapping. Basically, this is the canonized mapping equation in the complex plane
\displaystyle \begin{aligned} \mathbf{z} = 1 - i -\frac{\sqrt{-2i}}{K_e} \;\; F(cos ^{-1} \mathbf{w}\sqrt{i},\;\; \textstyle\frac{1}{\sqrt{2}}) \end{aligned}
(10)
and its inverse is
\displaystyle \begin{aligned} \mathbf{w} = \sqrt{-i} \;\; cn(K_e \mathbf{z} \sqrt{\textstyle\frac{i}{2}} - K_e,\;\; \textstyle\frac{1}{\sqrt{2}}) \end{aligned}
(11)
where z is the complex number x + y i

and w is the complex number u + v i.

It is probably appropriate to explain the $$\sqrt {\pm i}$$ factors that appear throughout the equations. These multiplicative constants are just a compact way of representing the ± 45 rotational adjustments needed to align the equations to the canonical mapping space in Fig. 2.

In the complex plane, rotation can be done simply by multiplication with the complex number e. For 45 rotation, the multiplicative factor is
\displaystyle \begin{aligned} \begin{array}{rcl} e^{i\frac{\pi}{4}} \;\; = \;\; \mathrm{cos}\frac{\pi}{4} + i \;\; \mathrm{sin}\frac{\pi}{4} \;\; = \;\;\frac{1}{\sqrt{2}}(1+i) \;\; = \;\; \sqrt{i} \end{array} \end{aligned}
(12)
For − 45 rotation, the multiplicative factor is
\displaystyle \begin{aligned} \begin{array}{rcl} e^{-i\frac{\pi}{4}} \;\; = \;\; \mathrm{cos}\frac{\pi}{4} - i \; \mathrm{sin}\frac{\pi}{4} \;\; = \;\; \frac{1}{\sqrt{2}}(1-i) \;\; = \;\; \sqrt{-i} \end{array} \end{aligned}
(13)

#### Software Implementation

In order to implement this mapping on a computer, one needs to be able to calculate special functions such as cn and F. Source code for numerical computation of these functions is readily available in open-source libraries such as Boost and the GNU Scientific Library. Also, there is a reference implementation appearing in the popular Numerical Recipes book (Press et al., 1992).

One possible pitfall in software implementation is that the mapping requires complex-valued versions of the special functions. These complex variants are typically not included in open-source libraries. Nonetheless, these complex variants are well-defined mathematically. The formulas for computing complex-valued cn and F are given by L.M. Milne-Thomson in the classic AMS-55 reference book (Abramowitz and Stegun, 1972).

It is worth mentioning here that there are well-established fast and robust algorithms for computing the F and cn special functions (Carlson, 1977). As a matter of fact, Gauss has shown that elliptic integrals can be calculated quickly using the arithmetic-geometric mean (Hancock, 1958). It is suffice to say that these special functions can be calculated about as fast as standard trigonometric functions.

### A Complex Class of Squircles

The Fernandez-Guasti squircle was used as groundwork in the development of the Tapered2 Squircular mapping. This section will discuss using a similar idea but acting in reverse to derive another type of squircle. Specifically, one can start with the Conformal Square mapping and come up with a different type of squircle called the complex squircle.

Let us revisit the squircular continuum in Fig. 5 which was originally discussed in the derivation of the Tapered2 Squircular mapping. By working backward this time and starting from the Conformal Square mapping, it is possible to derive equations for a curve that is an intermediate shape between the circle and the square.

Figure 14 shows a circular disc subdivided into concentric rings of different colors. This circular disc is then mapped to a square via the Conformal Square mapping. The resulting square is still subdivided by concentric rings, but the enclosing shapes are not quite circular. Consequently, it is logical to ask what sort of shape encompasses the boundaries of the concentric rings inside the square. Fig. 14The squircular continuum revisited

One can then intuitively surmise from Fig. 14 that the concentric shapes inside the square are some sort of squircular curve. Indeed, these concentric shapes exhibit all of the defining characteristics of a hybrid curve between the circle and the square. Therefore, it makes sense to classify them as yet another type of squircle – the complex squircle.

The complex squircle can be written in parametric form by applying Conformal Square mapping to the parametric equation of the circle. In the complex plane, the parametric form of the unit circle is eit, with 0 ≤ t ≤ 2π. By applying the Conformal Square mapping on the circle, one can come up with a complex-valued function ψ that serves as an auxiliary representation of the complex squircle.
\displaystyle \begin{aligned} \psi(t,q) \; = \; 1-i-\frac{\sqrt{-2i}}{K_e} F\left(\mathrm{cos} ^{-1} (q e^{it} \sqrt{i}),\textstyle\frac{1}{\sqrt{2}}\right) \end{aligned}
(14)

ψ is a two-parameter complex function that is based on the disc-to-square equation of the Conformal Square mapping. The first argument t is used for curve parametrization. The second argument q is just a squareness parameter analogous to the s parameter of the Fernandez-Guasti squircle.

Using this ψ function, the complex squircle can be defined as the curve arising from these parametric equations:
\displaystyle \begin{aligned} \begin{array}{rcl} x(t) \; = \; \Re[\psi(t,q)] \; \textstyle\frac{r}{\psi(0,q)} \\ y(t) \; = \; \Im[\psi(t,q)] \; \textstyle\frac{r}{\psi(0,q)} \end{array} \end{aligned}
(15)
As with the other types of squircles previously discussed, there are two parameters for the complex squircle: q and r. The squareness parameter q allows this shape to interpolate between the circle and the square. When q = 0, the equation produces a circle with radius r. When q = 1, the equation produces a square with a side length of 2r. In between, the equation produces a smooth planar curve that resembles both the circle and the square. This is shown in Fig. 15. Fig. 15The complex squircle at varying squareness values
In summary, mathematical shapes known as squircles play an important role in the development of disc-to-square mappings. This chapter discussed three different types of squircles along with associated mappings. These squircles are summarized in Table 1.
Table 1

Three different types of squircles discussed in this chapter

Name

Squareness

Equation

Key property

Fernandez-Guasti squircle

s ∈ [0, 1]

$$x^2 + y^2 -\frac {s^2}{r^2}x^2 y^2 = r^2$$

Quartic polynomial equation

Lamé squircle

p ∈ [2, )

|x|p + |y|p = rp

Unbounded polynomial power

Complex squircle

q ∈ [0, 1]

$$\begin {array}{c} \psi (t,q)= 1-i-\frac {\sqrt {-2i}}{K_e} F(cos ^{-1} (q e^{it} \sqrt {i}),\frac {1}{\sqrt {2}}) \\ \\ x(t) \; = \; \Re [\psi (t , q)] \; \frac {r}{\psi (0 , q)} \\ y(t) \; = \; \Im [\psi (t , q)] \; \frac {r}{\psi (0 , q)} \end {array}$$

Complex parametric equations with parameter t ∈ [0, 2π]

## Application: Squaring the Poincaré Disk

This section will discuss how to convert circular Escheresque artwork into squares. Figure 16 shows an example of a circular tiling with interlocking angels and devils. The pattern on the right was inspired from M.C. Escher’s famous Circle Limit IV (1960). The pattern on the left is its conversion to a square. Fig. 16A circular angels & devils pattern converted to a square

In order to delve more into Escheresque artworks (Dunham, 2009), some mathematical background in non-Euclidean geometry is necessary. In particular, we need to discuss a type of non-Euclidean geometry called hyperbolic geometry. To make things simple, we shall restrict ourselves to a two-dimensional construct of hyperbolic geometry called the hyperbolic plane. One can intuitively think of the hyperbolic plane as a surface with negative curvature everywhere (Taimina, 2009). In contrast, the Euclidean plane is a flat surface with zero curvature everywhere.

There is a long and storied history of non-Euclidean geometry that this chapter will only gloss over. Non-Euclidean geometry arises from the negation of Euclid’s fifth postulate – also known as the parallel postulate. A modern formulation of this postulate states that

In a plane, given a line and a point not on it, at most one line parallel to the given line can be drawn through the point.

This formulation is known as Playfair’s axiom. It is illustrated in the left diagram of Fig. 17. Meanwhile, hyperbolic geometry arises when Playfair’s axiom is overturned with the following statement:
In a hyperbolic plane, given a line and a point not on it, there are several lines parallel to the given line than can be drawn through the point. Fig. 17Playfair’s axiom on the Euclidean plane (left) and the hyperbolic plane (right)

In order to qualify this statement in hyperbolic geometry, one needs to have well-defined and consistent notions of points, lines, and parallelism in the hyperbolic plane. First, let us introduce the Poincaré disk.

Mathematicians have come up with many different models of the hyperbolic plane in order to study hyperbolic geometry. The most popular model is probably the Poincaré disk. The Poincaré disk can be considered as some sort of projection of the hyperbolic plane onto a unit circular disc in the Euclidean plane. It has several interesting properties that make it desirable for representing the hyperbolic plane.

One important property of the Poincaré disk is that it presents the entire hyperbolic plane within the confines of a finite circular disc in IR2. Every point in the hyperbolic plane is represented by a unique point inside the Poincaré disk. This makes it easy to visualize the entire hyperbolic plane within the model.

Another important property of the Poincaré diskis conformality. In a conformal model, the hyperbolic measure of angle is the same as the Euclidean measure of angle. In other words, this hyperbolic model does not distort angles. One can measure hyperbolic angles between geometric entities inside the Poincaré disk by simply making Euclidean angular measurements. Unfortunately, the same does not hold true for hyperbolic distance. Hyperbolic distances are greatly distorted in the Poincaré disk.

In the Poincaré disk model, the origin at (0, 0) lies at the center of the circular disc. The bounding circle at the rim of disc is infinitely far away from the origin. The hyperbolic distance of a point away from the origin gets larger and larger as the point gets closer to the bounding circle. As a consequence of this, geometric entities appear smaller as they approach the bounding circle.

One can think of the Poincaré disk in analogy to the Cartesian coordinate system. Just like the Cartesian coordinate system faithfully models the Euclidean plane, the Poincaré disk is a meaningful representation of the hyperbolic plane. The Cartesian coordinate system allows one to convert geometric statements about the Euclidean plane into algebraic equations. In a similar manner, the Poincaré disk allows one to do the same for the hyperbolic plane.

Table 2 lists various hyperbolic entities along with their Euclidean counterparts from within the Poincaré disk model. Using this table, one can make sense of Playfair’s axiom in the hyperbolic plane.
Table 2

Hyperbolic entities in the Poincaré disk

Geometric entity

Corresponding feature inside the Poincaré disk

Hyperbolic point

This corresponds to a Euclidean point in the interior of the bounding circle of the Poincaré disk model

Hyperbolic line

This corresponds to a circular arc orthogonal to the bounding circle. Circular arcs can be part of circles of arbitrary radius

Hyperbolic angle

The angle between two hyperbolic lines is the same as the Euclidean angle between their corresponding circular arcs inside the Poincaré disk model

Hyperbolic parallelism

Hyperbolic lines are parallel if and only if they do not intersect in the interior of the Poincaré disk model

### Hyperbolic Tilings

It is well-known that only three types of regular polygons can tile the Euclidean plane – namely, the triangle, the square, and the hexagon. These tilings are shown in Fig. 18. It is lesser known that all regular polygons can tile the hyperbolic plane! To illustrate this, Fig. 19 shows the Poincaré disk tiled with hyperbolic pentagons, heptagons, and octagons. Fig. 18The three regular Euclidean tilings Fig. 19Possible pentagonal, heptagonal, and octagonal tilings of the Poincaré disk
The stop sign is probably the most common octagonal shape that people encounter in their daily lives. It was ratified as an international standard by the United Nations in 1968. Being a regular octagon, the stop sign can tile the entire hyperbolic plane. This is shown in Fig. 20 as a Poincaré disk pattern. Furthermore, it is possible to convert this pattern into squares by using any of the three mappings discussed in this chapter. Fig. 20Hyperbolic stop signs

The most relevant and appropriate way to convert the Poincaré disk to a square is via Conformal Square mapping. There is a very simple reason for this – conformality. Recall that the Poincaré disc model is a conformal model of the hyperbolic plane. It follows that the conformal square is a natural extension of the Poincaré disc to a square region. In essence, undistorted Euclidean angles in the Poincaré disk remain intact in the conformal square.

The two other mappings can also be used to convert the Poincaré disk to a square, but the results are less than stellar. For the Elliptical Grid mapping, the corners of the square appear as a muddled mess. Meanwhile, the Tapered2 Squircular mapping produces fairly decent results, but there is significant shape distortion of the octagons.

To summarize, the conformal square is the natural extension of the Poincaré disk to a square. In order to further illustrate this, Fig. 21 shows the conformal square versions of the hyperbolic tilings from Fig. 19. Fig. 21Hyperbolic tilingsmapped to the conformal square

## Application: Elliptification of Rectangular Imagery

Most of the world’s photographs are rectangular. However, one might want to convert them into circular or elliptical images for artistic reasons. This section will extend the previously discussed square-to-disc mappings to handle ellipses and rectangles. After which, one can apply these mappings to rectangular artworks to produce elliptical ones. Henceforth, this process of molding a rectangle into an ellipse will be referred to as elliptification.

Elliptificationis very simple if one already has a square-to-disc mapping. Elliptification can be done by simply removing the eccentricity and then reintroducing it back after the square-to-disc mapping is performed. This procedure is shown in the top diagram in Fig. 22 along with an illustrative example showing the elliptification of the United States flag at the bottom. Fig. 22Elliptification: converting rectangular imagery to oval regions

The artistic process of elliptification is not new. For centuries, artists would paint on oval-shaped canvases, and photographers would cut their pictures into oval regions. Creating oval-shaped artworks is an important form of artistic expression and stylization. This has traditionally been done by just cropping or cutting out the corner regions of the artwork.

This chapter promotes the idea of using explicit mathematical mappings to create oval-shaped artworks. This is possible using any of the square-to-disc mappings covered in this chapter and related papers (Fong, 2014, 2019; Shirley and Chiu, 1997). To demonstrate this effect, Figs. 23 and 24 show Edouard Manet’s last major work “A Bar at the Folies-Bergere” (1882) converted into an oval region using the different mappings discussed in this chapter. The traditional process of simply cropping the picture to produce an oval region is quite unacceptable because it removes many noteworthy features near the corners of the painting. For example, observe that in Manet’s cropped painting, the bar patron with the top hat is gone. Also, the dangling legs of the trapeze artist at the top left corner of the painting are nowhere to be found. In contrast, the mathematically mapped paintings keep all these features intact, albeit distorted. Fig. 23Manet’s “A Bar at the Folies-Bergere” (1882) and its cropped version Fig. 24Elliptification of Manet’s famous impressionist painting

### Size Versus Shape Distortions

In differential geometry, two-dimensional distortion is generally categorized into two major types: size and shape distortions (Floater and Hormann, 2005). The elliptification of Manet’s painting highlights the difference between these two types of distortion. The stretched Schwarz-Christoffel based on the Conformal Square mapping has significant size distortions near the corner. This is quite evident by observing the dangling legs of the trapeze artist, which has shrunk to the point of being barely visible. In contrast, the Elliptical Grid mapping has significant shape distortions near the corner. Specifically, the gentleman with a top hat appears considerably deformed. On the other hand, the Tapered2 Squircular mapping offers a good compromise between size and shape distortions. It provides the best result among the three mappings for Manet’s painting. In fact, the circularized chessboard shown in Fig. 1 also uses the Tapered2 Squircular mapping. One can observe that the size and shape fidelity of the corner rooks is reasonably intact.

## Conclusion

This chapter discussed three explicit methods for mapping the circular disc to a square and vice versa. In addition, some artistic applications of these mappings were provided. For hyperbolic art, the Conformal Square mapping gives the best results. However, for other artistic applications such as elliptification, this is not necessarily the case because the mapping has sizeable distortions near the four corners.

## References

1. Abramowitz M, Stegun I (1972) Handbook of mathematical functions. Dover Publications Inc., New York
2. Carlson B (1977) Special functions of applied mathematics. Academic, New York
3. Dunham D (2009) Hamiltonian paths and hyperbolic patterns. Contemp Math 479:51–65
4. Fernandez-Guasti M (1992) Analytic geometry of some rectilinear figures. Int J Math Educ Sci Technol 23:895–901
5. Floater M, Hormann K (2005) Surface parameterization: a tutorial and survey. In: Dodgson N, Floater M, Sabin M (eds) Advances in multiresolution for geometric modelling. Springer, New York, pp 157–186
6. Fong C (2014) Analytical methods for squaring the disc. In: Seoul ICM 2014Google Scholar
7. Fong C (2019) Elliptification of rectangular imagery. In: Joint mathematics meeting SIGMAA-ARTSGoogle Scholar
8. Frederick C, Schwarz E (1990) Conformal image warping. IEEE Comput Graph Appl 10(2):54–61
9. Hancock H (1958) Elliptic integrals. Dover Publications Inc., New York
10. Langer J, Singer D (2011) The lemniscatic chessboard. Forum Geometricorum 11:183–199
11. Nowell P (2005) Mapping a square to a circle (blog). http://mathproofs.blogspot.com/2005/07/mapping-square-to-circle.html
12. Press W, Flannery B, Teukolsky S, Vetterling W (1992) Numerical recipes in C. The art of scientific computing, 2nd edn. Cambridge University Press, Cambridge
13. Rice A, Brown E (2012) Why ellipses are not elliptic curves. Math Mag 85(3):163–176
14. Shirley P, Chiu K (1997) A low distortion map between disk and square. J Graph Tools 2:45–52
15. Taimina D (2009) Crocheting adventures with hyperbolic planes. AK Peters, Wellesley

© Springer Nature Switzerland AG 2019

## Authors and Affiliations

1. 1.exile.orgSan FranciscoUSA

## Section editors and affiliations

• Bharath Sriraman
• 1
• Kyeong-Hwa Lee
• 2
1. 1.Department of Mathematical SciencesThe University of MontanaMissoulaUSA
2. 2.Department of Mathematics Education, College of EducationSeoul National UniversitySeoulSouth Korea