Squircles
A squircle is a shape that falls somewhere between a square and a circle. There isn't one defined formula for squircles, but instead they can be represented by various curves that fit the description. This intermediate shape can be adjusted to lean more towards either a square or a circle. The most well-known squircle is the superellipse, which was made popular by mathematician Piet Hein.
An article about its origin was published in Scientific American by Martin Gardner in 1977, and it can be found at https://piethein.com/superellipse/. However, that page is missing some equations and figures.
The superellipse has the formula $|x|^n + |y|^n = 1$, assuming a radius of 1. When n = 2, it results in a circle, and as n approaches infinity, it resembles a square. There isn't a standard way to measure squircles. For superellipses, the most common parameter is the exponent. For superellipses like the superellipse, a good measurement is the coordinates of the midpoint of the quadrant, which we'll call the gauge. This is the primary parameter for comparison between different squircle variants.
There are two main methods for creating squircles. One approach uses a single analytic curve with zero curvature at the poles and nonzero curvature elsewhere. The other method involves mixing straight line segments with corners. The latter method has an advantage in that it can adapt to rectangles of any aspect ratio without distorting the corner shape.
Squircles gained popularity when Apple changed the icon from a rounded rectangle to their own squircle in iOS 7 in 2013. However, there were some inaccuracies in the initial analysis, and it was later determined that the Apple squircle is actually a flat-sided squircle.
The Apple squircle has a few flaws, including an extra straight line segment and a lack of symmetry. However, these flaws are minor and only become apparent upon close examination. The gauge for the Apple squircle is fixed at 0.809, and it can only vary by changing the length of the flat side. Without a flat side, the gauge is fixed at 0.809.
There has been a lot of interest in the Apple squircle since its adoption in iOS 7. Figma published a blog post about the Apple squircle and their own approximation, which has been influential because Figma is a popular design tool. The Figma blog provides a plot of the Bézier segments comprising the Apple squircle, fixing some issues with the original version. The middle segment of the Figma squircle closely follows an arc, while the other segments are more complex and have a curvature discontinuity.
The CSS corner-shape property in CSS now supports squircle shapes, which are standard superellipse corners with added tweaks and animation support. While the CSS standard specifies the actual superellipse shape, practical implementations usually use a Bézier approximation. A closed-form approximation using two Bézier segments per quadrant has been developed using symbolic regression and is parametrized. It is most accurate when the midpoint is placed correctly, and it works well for exponents 2 and above.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.