 # Seashell Shapes

Make an interactive widget for exploring the shapes of seashells.

Run the code to plot a circle:

As u goes from 0 to 1, {Cos[u 2π], Sin[u 2π]} traces out a circle:

ParametricPlot[{Cos[u 2 \[Pi]], Sin[u 2 \[Pi]]}, {u, 0, 1}]

ParametricPlot[{Cos[u 2 \[Pi]], Sin[u 2 \[Pi]]}, {u, 0, 1}]

Plot the circle in 3D:

Plot a circle in the x-z plane in 3D:

ParametricPlot3D[{Cos[u 2 \[Pi]], 0, Sin[u 2 \[Pi]]}, {u, 0, 1}]

ParametricPlot3D[{Cos[u 2 \[Pi]], 0, Sin[u 2 \[Pi]]}, {u, 0, 1}]

Plot a logarithmic helix:

Heres a plot of a 2D logarithmic spiral. Its radius increases exponentially:

ParametricPlot[.5^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v]}, {v, 0, 4}]

Heres a plot of the 3D analog, a logarithmic helix. The spiral rises up the z axis as it unwinds:

ParametricPlot3D[.5^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], 1}, {v, 0, 4}]

ParametricPlot3D[.5^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], 1}, {v, 0, 4}]

Plot a shell shape:

Make a shell shape by sweeping a circle along a logarithmic helix. One side of the circle stays tangent to the z axis (drag the figure to view it from a different angle):

Well combine the following two plots to make the seashell shape. The parameter u controls the path around the circle, and v the progress along the helix:

{ ParametricPlot3D[{Cos[u 2 \[Pi]], 0, Sin[u 2 \[Pi]]}, {u, 0, 1}], ParametricPlot3D[.5^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], 1}, {v, 0, 4}] }

As the circle sweeps out the shell shape, it rotates so that it stays orthogonal to the helix, its radius changes so that one side of the circle stays on the z axis, and its center follows the helix.

Heres the circle:

ParametricPlot3D[{Cos[u 2 \[Pi]], 0, Sin[u 2 \[Pi]]}, {u, 0, 1}, {v, 0, 4}]

To make the center follow the path of the helix, translate it to the point on the helix by adding the expression for the helix to the expression for the circle. This doesnt yet look like a seashell because the circle is not yet rotating or changing radius:

ParametricPlot3D[{Cos[u 2 \[Pi]], 0, Sin[u 2 \[Pi]]} + .5^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], 1}, {u, 0, 1}, {v, 0, 4}]

Next, make the circle rotate as it follows the path of the helix. The helix point is at angle 2πv. RotationTransform[2πv,{0,0,1}] rotates the circle by 2πv about the z axis ({0,0,1}). Evaluate greatly speeds up the calculation by evaluating the rotation before its plotted:

ParametricPlot3D[ Evaluate[RotationTransform[2 \[Pi] v, {0, 0, 1}][{Cos[u 2 \[Pi]], 0, Sin[u 2 \[Pi]]}] + .5^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], 1}], {u, 0, 1}, {v, 0, 4}]

Finally, scale the circle so that it stays tangent to the z axis as it rotates. The scale factor is the distance of the helix from the z axis, .5^v. PlotRangeAll ensures that the entire shell is plotted (try removing it to see what happens):

ParametricPlot3D[ Evaluate[RotationTransform[ 2 \[Pi] v, {0, 0, 1}][.5^v {Cos[u 2 \[Pi]], 0, Sin[u 2 \[Pi]]}] + .5^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], 1}], {u, 0, 1}, {v, 0, 4}, PlotRange -> All]

To get a smoother shape, increase the number of plot points in the u and v directions with PlotPoints. Experiment with smaller values to see the effect:

ParametricPlot3D[ Evaluate[RotationTransform[ 2 \[Pi] v, {0, 0, 1}][.5^v {Cos[u 2 \[Pi]], 0, Sin[u 2 \[Pi]]}] + .5^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], 1}], {u, 0, 1}, {v, 0, 4}, PlotRange -> All, PlotPoints -> {20, 40}]

Remove the axes, box, and surface mesh:

ParametricPlot3D[ Evaluate[RotationTransform[ 2 \[Pi] v, {0, 0, 1}][.5^v {Cos[u 2 \[Pi]], 0, Sin[u 2 \[Pi]]}] + .5^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], 1}], {u, 0, 1}, {v, 0, 4}, PlotRange -> All, PlotPoints -> {20, 40}, Axes -> None, Boxed -> False, Mesh -> None]

ParametricPlot3D[ Evaluate[RotationTransform[ 2 \[Pi] v, {0, 0, 1}][.5^v {Cos[u 2 \[Pi]], 0, Sin[u 2 \[Pi]]}] + .5^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], 1}], {u, 0, 1}, {v, 0, 4}, PlotRange -> All, PlotPoints -> {20, 40}, Axes -> None, Boxed -> False, Mesh -> None]

Make it interactive. Drag the slider to stretch the shell vertically:

Make the shell expression interactive by wrapping it with Manipulate, adding a stretch parameter, and letting the stretch vary from 0 to 4 with an initial value of 1. The stretch parameter effectively scales the helix along the z axis, compressing or stretching the shell:

Manipulate[ ParametricPlot3D[ Evaluate[RotationTransform[ 2 \[Pi] v, {0, 0, 1}][.5^v {Cos[u 2 \[Pi]], 0, Sin[u 2 \[Pi]]}] + .5^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], st}], {u, 0, 1}, {v, 0, 4}, PlotRange -> All, PlotPoints -> {20, 40}, Axes -> None, Boxed -> False, Mesh -> None], {{st, 1, "stretch"}, 0, 4} ]

Manipulate[ ParametricPlot3D[ Evaluate[RotationTransform[ 2 \[Pi] v, {0, 0, 1}][.5^v {Cos[u 2 \[Pi]], 0, Sin[u 2 \[Pi]]}] + .5^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], st}], {u, 0, 1}, {v, 0, 4}, PlotRange -> All, PlotPoints -> {20, 40}, Axes -> None, Boxed -> False, Mesh -> None], {{st, 1, "stretch"}, 0, 4} ]

Add a control for the width. Drag the slider to change the width of the shell:

Add a parameter that makes the circle move away from the z axis as it sweeps. The slider controls how quickly it moves away:

Manipulate[ ParametricPlot3D[ Evaluate[RotationTransform[ 2 \[Pi] v, {0, 0, 1}][.5^v {Cos[u 2 \[Pi]] + w, 0, Sin[u 2 \[Pi]]}] + .5^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], st}], {u, 0, 1}, {v, 0, 4}, PlotRange -> All, PlotPoints -> {20, 40}, Axes -> None, Boxed -> False, Mesh -> None], {{st, 1, "stretch"}, 0, 4}, {{w, 0, "width"}, 0, 4} ]

Manipulate[ ParametricPlot3D[ Evaluate[RotationTransform[ 2 \[Pi] v, {0, 0, 1}][.5^v {Cos[u 2 \[Pi]] + w, 0, Sin[u 2 \[Pi]]}] + .5^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], st}], {u, 0, 1}, {v, 0, 4}, PlotRange -> All, PlotPoints -> {20, 40}, Axes -> None, Boxed -> False, Mesh -> None], {{st, 1, "stretch"}, 0, 4}, {{w, 0, "width"}, 0, 4} ]

Add a control for scaling. Drag the slider to change how quickly the shell scales down:

Add a parameter that controls how quickly the circle scales down as it moves around the helix:

Manipulate[ ParametricPlot3D[ Evaluate[RotationTransform[2 \[Pi] v, {0, 0, 1}][ sc^v {Cos[u 2 \[Pi]] + w, 0, Sin[u 2 \[Pi]]}] + sc^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], st}], {u, 0, 1}, {v, 0, 4}, PlotRange -> All, PlotPoints -> {20, 40}, Axes -> None, Boxed -> False, Mesh -> None], {{st, 1, "stretch"}, 0, 4}, {{w, 0, "width"}, 0, 4}, {{sc, .5, "scaling"}, .1, 1} ]

Manipulate[ ParametricPlot3D[ Evaluate[RotationTransform[2 \[Pi] v, {0, 0, 1}][ sc^v {Cos[u 2 \[Pi]] + w, 0, Sin[u 2 \[Pi]]}] + sc^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], st}], {u, 0, 1}, {v, 0, 4}, PlotRange -> All, PlotPoints -> {20, 40}, Axes -> None, Boxed -> False, Mesh -> None], {{st, 1, "stretch"}, 0, 4}, {{w, 0, "width"}, 0, 4}, {{sc, .5, "scaling"}, .1, 1} ]

Add a control for transparency. Drag the slider to make the shell transparent:

Add a control for transparency. As the transparency goes from 0 to 1, the opacity goes from 1 to 0:

Manipulate[ ParametricPlot3D[ Evaluate[RotationTransform[2 \[Pi] v, {0, 0, 1}][ sc^v {Cos[u 2 \[Pi]] + w, 0, Sin[u 2 \[Pi]]}] + sc^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], st}], {u, 0, 1}, {v, 0, 4}, PlotRange -> All, PlotPoints -> {20, 40}, Axes -> None, Boxed -> False, Mesh -> None, PlotStyle -> Opacity[1 - tr]], {{st, 1, "stretch"}, 0, 4}, {{w, 0, "width"}, 0, 4}, {{sc, .5, "scaling"}, .1, 1}, {{tr, 0, "transparency"}, 0, 1} ]

Manipulate[ ParametricPlot3D[ Evaluate[RotationTransform[2 \[Pi] v, {0, 0, 1}][ sc^v {Cos[u 2 \[Pi]] + w, 0, Sin[u 2 \[Pi]]}] + sc^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], st}], {u, 0, 1}, {v, 0, 4}, PlotRange -> All, PlotPoints -> {20, 40}, Axes -> None, Boxed -> False, Mesh -> None, PlotStyle -> Opacity[1 - tr]], {{st, 1, "stretch"}, 0, 4}, {{w, 0, "width"}, 0, 4}, {{sc, .5, "scaling"}, .1, 1}, {{tr, 0, "transparency"}, 0, 1} ]

Share ItMake an interactive website for exploring seashell shapes:

Deploy the Manipulate to the Wolfram Cloud where anyone with a browser can use it:

CloudDeploy[ Manipulate[ ParametricPlot3D[ Evaluate[ RotationTransform[2 \[Pi] v, {0, 0, 1}][ sc^v {Cos[u 2 \[Pi]] + w, 0, Sin[u 2 \[Pi]]}] + sc^v {Cos[2 \[Pi] v], Sin[2 \[Pi] v], st}], {u, 0, 1}, {v, 0, 4}, PlotRange -> All, PlotPoints -> {20, 40}, Axes -> None, Boxed -> False, Mesh -> None, PlotStyle -> Opacity[1 - tr]], {{st, 1, "stretch"}, 0, 4}, {{w, 0, "width"}, 0, 4}, {{sc, .5, "scaling"}, .1, 1}, {{tr, 0, "transparency"}, 0, 1} ], Permissions -> "Public" ]

Click on the link in the output to visit the site.