A Superellipsoid or super-egg. You can control the shape using these values: r t A B C

The default values give Piet Hein's superegg. Other interesting cases to try are:

Superellipsoids are three dimensional versions of superellipses which in turn are a cross between a square and a circle. A circle has equation $x^2+y^2=1$ if we generalise that we get the superellipses $x^p+y^p=1$. You can play with the 2D version parametric version (faster) implicit verson (slower).

The equation for the superellipsoid is $\left(\left|{\frac {x}{A}}\right|^{r}+\left|{\frac {y}{B}}\right|^{r}\right)^{{t/r}}+\left|{\frac {z}{C}}\right|^{{t}}=1$. To generate the mesh I have started with a mesh on a cube, project them onto a sphere, and find the spherical coordinates, $\rho=\sqrt{x^2+y^2+z^2}$, $\theta=\mathrm{atan2}(y,x)$, $\phi=\mathrm{asin}(z/\rho)$. Using the polar representation for the superellipse $$ \begin{align} X(\theta,\phi)=&A\,c(\phi,2/t)\ c(\theta,2/r)\\ Y(\theta,\phi)=&B\,c(\phi,2/t)\ s(\theta,2/r)\\ Z(\theta,\phi)=&C\,s(\phi,2/t). \end{align} $$ Where $c(v,t) = \operatorname{sgn}(\cos v )|\cos v |^{t}$, $s(v,t) = \operatorname{sgn}(\sin v )|\sin v |^{t}$. This simplifies to $$ \begin{align} X(x,y,z) = &A\,p(m/\rho,2/t)\ p(x/m,2/r)\\ X(x,y,z) = &B\,p(m/\rho,2/t)\ p(y/m,2/r)\\ X(x,y,z) = &C\,p(z/\rho,2/t)\\ \end{align} $$ with $p(v,t)=\operatorname{sgn}(v )|v|^{t}$ and $m=\sqrt{x^2+y^2}$. See this answer at stackoverflow.

Readers comments

Definition of the theta and phi

Yibin Jiang Mon Nov 19 2018

The definition of theta and phi can be varied according to t and r. Theta is not always defined by atan2(x,y), neither as phi.

Add a comment/link:

Enter your comment about this page here.



Links To add a link to another website with useful info add the details here.
Name of Site:
URL for Site:

Your Name:
email address:
Email addressed added here will not be displayed on the website or be passed to third parties.
They are used incase we need to get in touch with you.
6 + 3 =
Answer the sum to prove your not a robot. As we all know robots can't add.
To prevent spam all comments are moderated, comments with spam or swearing are blocked.

Msqli defined