## Introduction: How to Generate and 3D Print Seashells and ... Other Mollusks!

Daughter of stone and the beautifying tide,

With what wonder you fill boys’ minds

La conchiglia Marina di Alceo,

Translation of Salvatore Quasimodo, Greek Lyrics, 1940.

Since ancient times, the elegant shape of the shells has fascinated children and adults. These marvellous and elaborate sculptures of calcium carbonate are variations of a common mathematics theme: the three-dimensional logarithmic spiral. The mesmerizing spiralizing geometries and patterns go straight to the mathematical hardwiring circuitry of our brain that stimulated the intellectual pleasure of its sighting. Poets such as the Geek Alceo and the genius artist Sandro Botticelli (in his masterpiece “*The birth of Venus”*) have been so captivated by the delight of the elegant housing of molluscan to be inspired in their work of poetry and art. But the interest in the mathematical formulation of seashell geometry must wait until the first half of the 19th century. The first attempt to translate the geometry of nature in the mathematical language was due to the English mathematician Reverend H. Moseley (1801-1872) that based on measurements on the shape of several seashell specimens correctly formulated a mathematical model based on the helico-spiral description. It was followed by the works of other biologists and mathematicians. The great Scottish biologist and mathematician D’arcy Wentworth Thompson described these early efforts in detail in his 1917 masterpiece *On Growth and Form *[1]. An important stimulus to the mathematical modelling of seashell shape came in the 1960 when the use of the earlier electronic computers allowed to calculate and depict these shapes. An important contribution was given by Raup in his celebrated Science papers [2] that introduced the concept of *morphospace* in the description of the Mollusca shell forms. The personal and microcomputer revolution from the end of 1970 signed up another important development in the mathematical modelling of natural shapes. The use of more sophisticated computer graphics allowed to implement and sophisticate the original models with variation to account for the different shapes in the natural history of seashells. These brought important contributions from different scientists that published models for different classes of molluscan and gastropods also providing programs in different programming languages.

One of the most complete models was published by M.B. Cortie in 1989 [3]. The model uses a total of 16 parameters to describe not only the overall shape but also complex details of the surface of some of the species. The model unified all the properties introduced in the previous models in an easy to implementing coordinate function for the shell surface generation.

In this Instructable, we present a program written in C++ with graphics based on OpenGL library that implement Cortie’s model using a simple interface that allows the variation of the parameters. The model exports the generated surface in STL format that can be used for 3D printing or in other programs for 3D modelling.

**References**

- D'Arcy W. Thompson.
*On Growth and Form*. (2nd edition 1944). - David M. Raup,” Computer as Aid in Describing Form in Gastropod Shells”,
*Science*138.3537 (1962): 150-152. Raup, D. M., and A. Michelson. "Theoretical morphology of the coiled shell."*Science*147.3663 (1965): 1294-1295. See also the description in Richards Dawkins.*Climbing Mount Impossible*(1996). - M. Cortie,
*Models for mollusc shell shape*, South African Journal of Science, vol. 85, pp. 454–460, 1989.

## Supplies

- The program provided with this instructable is written in C++. It has been compiled and tested using GNU g++ compiler on computers with macOS and Linux operative systems and OpenGL (https://www.opengl.org) and the utility libraries GLU, and GUI library properly installed. Normally, the OpenGL library came with the OS or it can be easily installed using the OS software management tools. The GUI library can be freely downloaded and installed from the GITHUB site: https://github.com/libglui/glui. It should not be a problem to compile it on other OS provided the correct installation of the graphical libraries.
- We have used PrusaSlicer to prepare
*gcode*files for the printed seashell shown in the Instructable. In the past, I have used also Ultimaker Cura with good results. You need to spend some time to find the best orientation of the model to produce a correct print. Some orientations miss printing layers as the STL code generated by our program is very simple and not optimized. - For the 3D Printing, we have used a Ender 5 Pro. The examples shown in the Instructable have been printed using a layer height of 0.2 mm with 1.75 mm PLA filament.

## Step 1: the Cortie's Model

Cortie’s model is based on the translations and scaling of a shape representing the aperture of the shell along the so-called helico-spiral curve. In Figure 1, a schematic representation of the helico-spiral curve is shown. The coiling of the spiral is a function of the distance from the centre in the x-y plane and along the z-direction (helical translation).

Figure A to D shows the sequence of mathematic transformation used in the model to derive the final coordinates of the shell surface. The final coordinates are calculated for the discrete coordinate (s) representing the aperture curve and t the coiling along the helico-spiral.

The combination of all the three steps (A, B, C) corresponds to the set of equations shown in Figure [D]. The meaning of some of the parameters is indicated in the same Figure.

**PARAMETERS FOR THE HELICO-SPIRAL**

**NC: ** number of repeated aperture curves along the helico-spiral.

**alpha:** equiangular angle of the spiral.

**beta:** angle between z-axis and line from aperture local origin to xyz origin.

**ts:** starting angle for the helico-spiral.

**te: ** ending angle for the helico-spiral.

**A: ** distance from main origin to local origin of aperture at theta=0.

**a:** major radius of ellipse at theta=0.

**b: ** minor radius of ellipse at theta=0.

**PARAMETERS FOR THE APERTURE SHAPE**

**NS: ** number of discrete sides of the aperture curve.

**phi:** tilting angle of the ellipse major axis from horizontal plane.

**mu:** leaning angle over of the aperture curve.

**omega:** azimuthal rotation angle of the aperture curve.

**sm:** angle at which aperture-generating curve begins.

**sx: ** angle at which aperture-generating curve ends.

**PARAMETERS FOR THE SURFACE SCULPTURE (HUMPS ON THE APERTURE CURVE)**

**NM: ** number of humps along the aperture.

**P: ** position of the hump as function of the angle s.

**W1 ** width of the hump along the aperture curve (s-direction).

**W2 ** width of the hump along the helico-spiral curve (t-direction).

**L:** height of the hump at theta=0.

**SYMMETRY OF THE HELICO_SPIRAL**

**D:** Symmetry of the helico-spiral.

= 1, dextral coiling,

=-1, sinistral coiling).

A complete description of the model can be found in the original Cortie's article, or on dedicated websites as the gorgeous one by J. Picado.

https://www.maa.org/sites/default/files/images/upload_library/23/picado/seashells/index.html

## Step 2: The C++ Implementation

The model is implemented in C++ language using OpenGL, GLUT, and GLUI libraries.The program was developed using a macOS and it can be compiled using the command:

g++ ShellmodelsCortie.cpp -o ShellmodelsCortie -framework opengl -framework cocoa -framework glut -lglui -Wno-deprecated

We have also tested on a Linux OS, in this case, you need to change the headers as follows

#include <GL/glut.h> #include <GL/gl.h> #include <GL/glu.h> #include <GL/glui.h>

and, I have used for compiling the command

g++ ShellmodelsCortie.cpp -o ShellmodelsCortie -lGL -lGLU -lglut -lglui-std=c++11

Note that the command assumes that the library is installed in the default system directories. The GLUI library is not always a default library in Linux OS distribution. In this case, you first need to download and install the library.

The program consists of a simple user interface in which the model parameters can be typed or changed using spinners (in the red squares in the Figure).

The model can be directly rotated by pressing and moving the finger on the touch pad (or using the mouse) on the display window and zoom in/out using the scale factor in the control panel.

The model can be represented as wireframed or solid surface using the radio buttons on the control panel (in the blu square). Random colorized bands are used to decorate the surface. The Directrix option is used to show the center of geometry of each aperture (in yellow) and one aperture shape at a given position along the helico-spiral. This option can be used to check the effect of the aperture shape parameters.

Finally, A predefined molluscan models can be selected by selecting them form a list (in purple square).

Suggestions on how to improve the program are always welcome!

### Attachments

## Step 3: 3D Printing

In the control panel, you can also find the button to export the model as STL file. This file can be imported into a 3D graphics program for further modification. It can be 3D printed by preparing a gcode file using a slicer program.

For 3D printing the models, we have used PusaSlicer (see supply section) with good results. Note that the STL file is not optimized and provides only the coordinates of the shell surface. The slicer fixes several errors but still, the orientation of the shell is important to get good results. To avoid such artifacts (such as the omission of layers), the shell aperture should be oriented upward (as in the example of figures provided in the instructable).

Suggestions on how to improve the STL file are very welcome.

In the next steps, some results obtained using the examples in the program are shown.

## Step 4: Examples of Results

## Step 5:

## Step 6:

## Step 7: Conclusions

I conclude this Instructable showing an artistic painting of one of the models using MashLab software, and, as usual, I leave it to my son Leonardo to draw his conclusions on this project.

The shell has evolved in many ways over many millions of years to fit its holder when in different environments. Each time the creature faced a challenge the shell evolved to solve or be part of the solution to the problem. And as more challenges evolved the shell became more complex. This led to the many varieties of shells we have today on land and in the sea. But the shell is even now evolving and giving us more patterns that can be only described in mathematics. Our computer program tries to replicate this idea and forming shells solely using mathematics. And this is reason for this instructable. And it is also the reason we want to show this to you my dear viewer. As the shell is part of nature and nature is mathematics. We want to show you how the beauty comes from patterns and numbers, not only in shells but plants , rocks and all of nature. This program however small or simple may provide a small window to the secret of the world. It may even inspire you to enlarge that window. So next time you look at a plant or maybe an animal, not only think of its beauty but how it creates its beauty.

This project has been a joy to work on and gave me an even more refined view of the natural world. I sincerely hope it does the same to you or at least spark your curiosity once more. Good exploration only creates more questions and curiosities!

Runner Up in the

Made with Math Contest

## 2 Comments

1 year ago

Wow, this is pretty cool!

Reply 1 year ago

Thank you!