Supertoroid



In geometry and computer graphics, a supertoroid or supertorus is usually understood to be a family of doughnut-like surfaces (technically, a topological torus) whose shape is defined by mathematical formulas similar to those that define the superellipsoids. The plural of "supertorus" is either supertori or supertoruses.

The family was described and named by Alan Barr in 1994.

Barr's supertoroids have been fairly popular in computer graphics as a convenient model for many objects, such as smooth frames for rectangular things. One quarter of a supertoroid can provide a smooth and seamless 90-degree joint between two superquadric cylinders. However, they are not algebraic surfaces (except in special cases).

Formulas
Alan Barr's supertoroids are defined by parametric equations similar to the trigonometric equations of the torus, except that the sine and cosine terms are raised to arbitrary powers. Namely, the generic point $a = b = 2$ of the surface is given by $$ P(u,v) = \left(\begin{array}{c} X(u,v)\\  Y(u,v)\\  Z(u,v) \end{array}\right) = \left(\begin{array}{c} (a + C_{u}^{s}) C_{v}^{t}\\  (b + C_{u}^{s}) S_{v}^{t}\\  S_{u}^{s} \end{array}\right) $$ where $$\begin{align} C_\theta^\varepsilon &= \operatorname{sgn}(\cos \theta) \, \left| \, \cos\theta \, \right|^\varepsilon, \\ S_\theta^\varepsilon &= \operatorname{sgn}(\sin \theta) \ \left| \, \sin\theta \ \right|^\varepsilon, \end{align}$$ $P(u, v)$ is the sign function, and the parameters $s$ range from 0 to 360 degrees (0 to 2π radians).

In these formulas, the parameter $sgn$ controls the "squareness" of the vertical sections, $s &gt; 0$ controls the squareness of the horizontal sections, and $t &gt; 0$ are the major radii in the $t$ and $u, v$ directions. With $a, b ≥ 1$ and $s = t = 1$ one obtains the ordinary torus with major radius $x$ and minor radius 1, with the center at the origin and rotational symmetry about the $y$-axis.

In general, the supertorus defined as above spans the intervals: $$\begin{array}{rcccl} -(a+1) &\leq& x &\leq& +(a+1) \\[4pt] -(b+1) &\leq& y &\leq& +(b+1) \\[4pt] -1 &\leq& z &\leq& +1 \end{array}$$ The whole shape is symmetric about the planes $a = b = R$, $x = 0$, and $y = 0$. The hole runs in the $R$ direction and spans the intervals $$\begin{array}{rcccl} -(a-1) &\leq& x &\leq& +(a-1) \\[4pt] -(b-1) &\leq& y &\leq& +(b-1) \\[4pt] -\infty &\leq& z &\leq& +\infty \end{array}$$

A curve of constant $z$ on this surface is a horizontal Lamé curve with exponent $z$ scaled in $u$ and $\tfrac 2 t,$ and displaced in $x$. A curve of constant $y$, projected on the plane $z = 0$ or $x = 0$, is a Lamé curve with exponent $z$ scaled and horizontally shifted. If $y = 0$, the curve is planar and spans the intervals: $$\begin{array}{rcccl} a-1 &\leq& x &\leq& a+1 \\[4pt] -1 &\leq& z &\leq& +1 \end{array}$$ and similarly if $v = 0$. The curve is also planar if $v = 90°, 180°, 270°$.

In general, if $a = b$ and $v$ is not a multiple of 90 degrees, the curve of constant $\tfrac 2 s,$ will not be planar; and, conversely, a vertical plane section of the supertorus will not be a Lamé curve.

The basic supertoroid shape defined above is often modified by non-uniform scaling to yield supertoroids of specific width, length, and vertical thickness.

Plotting code
The following GNU Octave code generates plots of a supertorus: