Superquadrics
In mathematics, the superquadrics or super-quadrics (also superquadratics) are a family of geometric shapes defined by formulas that resemble those of ellipsoids and other quadrics, except that the squaring operations are replaced by arbitrary powers. They can be seen as the three-dimensional relatives of the superellipses. The term may refer to the solid object or to its surface, depending on the context. The equations below specify the surface; the solid is specified by replacing the equality signs by less-than-or-equal signs.
The superquadrics include many shapes that resemble cubes, octahedra, cylinders, lozenges and spindles, with rounded or sharp corners.<ref name="barr81" /> Because of their flexibility and relative simplicity, they are popular geometric modeling tools, especially in computer graphics. It becomes an important geometric primitive widely used in computer vision,<ref name=":1" /><ref name=":0" /> robotics,<ref>Template:Cite journal</ref> and physical simulation.<ref>Template:Cite journal</ref>
Some authors, such as Alan Barr, define "superquadrics" as including both the superellipsoids and the supertoroids.<ref name="barr81">Template:Cite journal</ref><ref name="barr92">Alan H. Barr (1992), Rigid Physically Based Superquadrics. Chapter III.8 of Graphics Gems III, edited by D. Kirk, pp. 137–159</ref> In modern computer vision literatures, superquadrics and superellipsoids are used interchangeably, since superellipsoids are the most representative and widely utilized shape among all the superquadrics.<ref name=":1">Template:Cite book</ref><ref name=":0" /> Comprehensive coverage of geometrical properties of superquadrics and methods of their recovery from range images and point clouds are covered in several computer vision literatures.<ref name="barr81" /><ref name=":0">Template:Cite book</ref><ref>Aleš Jaklič, Aleš Leonardis, Franc Solina (2000) Segmentation and Recovery of Superquadrics. Kluwer Academic Publishers, Dordrecht</ref><ref>Template:Cite book</ref>
FormulasEdit
Implicit equationEdit
The surface of the basic superquadric is given by
- <math> \left|x\right|^r + \left|y\right|^s + \left|z\right|^t =1</math>
where r, s, and t are positive real numbers that determine the main features of the superquadric. Namely:
- less than 1: a pointy octahedron modified to have concave faces and sharp edges.
- exactly 1: a regular octahedron.
- between 1 and 2: an octahedron modified to have convex faces, blunt edges and blunt corners.
- exactly 2: a sphere
- greater than 2: a cube modified to have rounded edges and corners.
- infinite (in the limit): a cube
Each exponent can be varied independently to obtain combined shapes. For example, if r=s=2, and t=4, one obtains a solid of revolution which resembles an ellipsoid with round cross-section but flattened ends. This formula is a special case of the superellipsoid's formula if (and only if) r = s.
If any exponent is allowed to be negative, the shape extends to infinity. Such shapes are sometimes called super-hyperboloids.
The basic shape above spans from -1 to +1 along each coordinate axis. The general superquadric is the result of scaling this basic shape by different amounts A, B, C along each axis. Its general equation is
- <math> \left|\frac{x}{A}\right|^r + \left|\frac{y}{B}\right|^s + \left|\frac{z}{C}\right|^t = 1.</math>
Parametric descriptionEdit
Parametric equations in terms of surface parameters u and v (equivalent to longitude and latitude if m equals 2) are
- <math>\begin{align}
x(u,v) &{}= A g\left(v,\frac{2}{r}\right) g\left(u,\frac{2}{r}\right) \\ y(u,v) &{}= B g\left(v,\frac{2}{s}\right) f\left(u,\frac{2}{s}\right) \\ z(u,v) &{}= C f\left(v,\frac{2}{t}\right) \\ & -\frac{\pi}{2} \le v \le \frac{\pi}{2}, \quad -\pi \le u < \pi ,
\end{align}</math> where the auxiliary functions are
- <math>\begin{align}
f(\omega,m) &{}= \sgn(\sin \omega) \left|\sin \omega \right|^m \\ g(\omega,m) &{}= \sgn(\cos \omega) \left|\cos \omega \right|^m
\end{align}</math> and the sign function sgn(x) is
- <math> \sgn(x) = \begin{cases}
-1, & x < 0 \\ 0, & x = 0 \\ +1, & x > 0 .
\end{cases}</math>
Spherical productEdit
Barr introduces the spherical product which given two plane curves produces a 3D surface. If <math display="block">f(\mu)=\begin{pmatrix}f_1(\mu) \\ f_2(\mu)\end{pmatrix},\quad g(\nu)=\begin{pmatrix}g_1(\nu)\\g_2(\nu)\end{pmatrix}</math> are two plane curves then the spherical product is <math display="block">h(\mu,\nu) = f(\mu)\otimes g(\nu) = \begin{pmatrix} g_1(\nu)\ f_1(\mu) \\ g_1(\nu)\ f_2(\mu) \\ g_2(\nu) \end{pmatrix}</math> This is similar to the typical parametric equation of a sphere: <math display="block">\begin{align} x&=x_{0}+r\sin \theta \;\cos \varphi \\ y&=y_{0}+r\sin \theta \;\sin \varphi \qquad (0\leq \theta \leq \pi ,\;0\leq \varphi <2\pi )\\ z&=z_{0}+r\cos \theta \end{align}</math> which give rise to the name spherical product.
Barr uses the spherical product to define quadric surfaces, like ellipsoids, and hyperboloids as well as the torus, superellipsoid, superquadric hyperboloids of one and two sheets, and supertoroids.<ref name="barr81"/>
Plotting codeEdit
The following GNU Octave code generates a mesh approximation of a superquadric: <syntaxhighlight lang="matlab"> function superquadric(epsilon,a)
n = 50; etamax = pi/2; etamin = -pi/2; wmax = pi; wmin = -pi; deta = (etamax-etamin)/n; dw = (wmax-wmin)/n; [i,j] = meshgrid(1:n+1,1:n+1) eta = etamin + (i-1) * deta; w = wmin + (j-1) * dw; x = a(1) .* sign(cos(eta)) .* abs(cos(eta)).^epsilon(1) .* sign(cos(w)) .* abs(cos(w)).^epsilon(1); y = a(2) .* sign(cos(eta)) .* abs(cos(eta)).^epsilon(2) .* sign(sin(w)) .* abs(sin(w)).^epsilon(2); z = a(3) .* sign(sin(eta)) .* abs(sin(eta)).^epsilon(3);
mesh(x,y,z);
end </syntaxhighlight>