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 x2+y2=1 if we generalise that we get the superellipses xp+yp=1. You can play with the 2D version parametric version (faster) implicit verson (slower).

The equation for the superellipsoid is (|xA|r+|yB|r)t/r+|zC|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, ρ=x2+y2+z2, θ=atan2(y,x), ϕ=asin(z/ρ). Using the polar representation for the superellipse X(θ,ϕ)=Ac(ϕ,2/t) c(θ,2/r)Y(θ,ϕ)=Bc(ϕ,2/t) s(θ,2/r)Z(θ,ϕ)=Cs(ϕ,2/t). Where c(v,t)=sgn(cosv)|cosv|t, s(v,t)=sgn(sinv)|sinv|t. This simplifies to X(x,y,z)=Ap(m/ρ,2/t) p(x/m,2/r)X(x,y,z)=Bp(m/ρ,2/t) p(y/m,2/r)X(x,y,z)=Cp(z/ρ,2/t) with p(v,t)=sgn(v)|v|t and m=x2+y2. 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.

Subject:

 

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

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.
3 + 9 =
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