## Introduction: Modelling and Designing of Bird Eggs for 3D Printing

When you start with a portrait and search for a pure form,
a clear volume, through successive eliminations, you arrive
inevitably at the egg. Likewise, starting with the egg and
following the same process in reverse, one finishes with
the portrait.
PABLO PICASSO

### INTRODUCTION

Easter is at the door, giving the occasion to talk about eggs and their mathematical shapes. This Instructable aims to introduce a simple mathematical model to generate the 3D form of real bird eggs utilizing several parameters. The 3D egg models can be saved as an STL file and printed using a 3D printer. The printed egg can be painted or modified with a CAD program to add functionalities for egg-based gadgets or toys. An example of a modification to create a LED decorated egg is explained in detail.

In the book by J. Adams, A Mathematical Walk in Nature , you can find a short review of the different mathematical modeling approaches to describe the shape of an egg. Among them, Baker's paper about the geometrical side of eggs  is revealed to be one of the most versatile as it can very accurately reproduce the shapes of a large variety of bird eggs . Moreover, the model was used to perform a systematic and comparative study of the bird eggs' shape .

More information about the connection of the above egg shapes example with those of real bird eggs can also be found in these articles:

https://wordpress.com/post/daniloroccatano.blog/3792

https://wordpress.com/post/daniloroccatano.blog/5171

https://wordpress.com/post/daniloroccatano.blog/6760

BIBLIOGRAPHY

1. J. A. Adams. A Mathematical Nature Walk. Princeton University Press. 2011.
2. D. E. Baker. A Geometric Method for Determining Shape of Birds Eggs. The Auk 119(4):1179–1186, 2002.
3. M. C. Stoddard et al. Avian egg shape: Form, function, and evolution.Science 356, 1249–1254 (2017).
4. L. Edwards. The Vortex of Life: Nature's Patterns in Space and Time. Floris Books, 2nd Revised edition edition (4 May 2006).

## Supplies

• The C++ program generates the egg shape model in STL format.
• A slicer program. We have used Cura and PrusaSlicer software.
• A 3D printer. We have used a Wanhao duplicator i3 and a Creality Ender 5 Pro.
• For an egg toy, a LED controlling circuit recovered from a broken gel-filled flashing bouncy ball toy was used.

## Step 1: The Mathematical Model

Baker's equation is based on a fundamental transformation from projective geometry. This mathematical description generates " path curves" resembling natural shapes such as eggs, buds, and embryos. This model was initially developed by L. Edwards  based on the previous idea of other mathematicians. Baker's equation is shown in Figure, T, and lambda are two parameters that control the shape of the egg.

In the paper by Stoddard et al. , the asymmetry (A=lambda-1 ) and ellipticity (E = 1/T - 1) parameters are used instead to define the geometric properties of the analyzed eggs. For example, the 2D egg shape in the Figure is generated using A=0 and E = 1.

As shown in the Figure, the 3D shape of the eggs is then generated by rotating the egg shape profile along the x-axis.

BIBLIOGRAPHY

1. L. Edwards. The Vortex of Life: Nature's Patterns in Space and Time. Floris Books, 2nd Revised edition edition (4 May 2006).

## Step 2:

The mathematical model has been implemented in a simple graphical program in C++ controlled by an essential GUI based on the OpenGL, GLUT, and GLUI graphic libraries.

The provided C++ program can be compiled under macOS using the command:

`g++ eggshapes.cpp -framework opengl -framework cocoa -framework glut -Wno-deprecated -lglui`

We have also tested on a Linux OS. In this case, you need to change the headers as follows, and we have used it for compiling the command.

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

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

The program consists of a simple user interface that you can see in the Figures. The model parameters can be typed or changed using spinners. The model can be directly rotated by pressing and moving the finger on the touchpad (or using the mouse) on the display window and zooming in/out using the scale factor in the control panel. The model surface can be colorized using random colored stripes or squares.

We have added some screenshots of the program provided with this Instructable. The Backer formula will produce a spherical egg if the two parameters equal zero (e.g., A=0 and E=0). As the parameter E value increases, the egg shape becomes more elliptic (see, for example, the case with A=0 and E=1, shown in Figure 2). Conversely, if the value of parameter A increases, the egg shape becomes more asymmetric (see, for example, the egg shape with A=1 and E=0 in Figure 3).

The author makes no warranties about the software and disclaims liability for all software uses to the fullest extent permitted by applicable law. The software is made freely available solely for a sharing purpose. Suggestions on how to improve the program are very welcome.

## Step 3: 3D Printing

You can also find the button to export the model as an STL file in the control panel. The STL file can be imported into a 3D graphics program for further modification. It can also be 3D printed by preparing a gcode file using a slicer program. Note that the STL file is not optimized and provides only the coordinates of the shell surface. Suggestions on how to improve the STL file are very welcome.

For the models shown in the Instructables, we have prepared the gcode file using the PusaSlicer (see supply section) with slices up to 0.32 mm and 10 or 20% infill. The model was printed using a Wanhao duplicator i3 and a Creality Ender 5 printer.

## Step 4: Modifying the Egg STL File

The STL file produced by the printer can be printed, and the egg can be decorated or manipulated using a 3D CAD to transform it into a functional gadget/toy or an object of design.

This example shows how to use OpenScad to modify an egg by inserting a LED driving circuit recovered from a broken gel-filled flashing bouncy ball toy.

OpenSCAD is a versatile software for creating solid 3D CAD objects. It has commands to load an STL file and manipulate it. The following command loads the file egg.stl and scales if of a fact 3 in x,y, z-direction.

`scale(3,3,3) import("./egg.stl", convexity=3);    `

To create an empty eggshell, the difference() operator with the same egg.stl scale slightly less.

`difference() {    scale(3,3,3) import("./egg.stl", convexity=3);      scale(2.8,2.8,2.8) import("./egg.stl", convexity=3);  }`

The two shells can be separated by removing half of it by difference with a parallelepiped.

`difference() {     scale(3,3,3) import("./egg.stl", convexity=3);       scale(2.8,2.8,2.8) import("./egg.stl", convexity=3);      translate ([0,15,0])  cube ([80,30,60],center=true);  } `

The two shells can be defined as separated objects using the module command.

`module EggShellLeft(){   difference() {     scale(3,3,3) import("./egg.stl", convexity=3);       scale(2.8,2.8,2.8) import("./egg.stl", convexity=3);      translate ([0,15,0])  cube ([80,30,60],center=true);     } }module EggShellRight(){   difference() {     scale(3,3,3) import("./egg.stl", convexity=3);       scale(2.8,2.8,2.8) import("./egg.stl", convexity=3);      translate ([0,-15,0])  cube ([80,30,60],center=true);     } }`

In further modifications, the module command simplifies using the two shells as separate objects. The shells have been modified to accommodate the reported code's LED circuit and switch button. Finally, two pegs in one shell and two holes in the other have been added to bind the shells together.

The following openSCAD code produces the results shown in the Figures.

`\$fn=100;left=1; // Select one shell of the othermodule ModEggEmpty(){ difference() {  scale(3,3,3) import("./EggSample.stl", convexity=3);    difference(){    scale(2.8,2.8,2.8) import("./EggSample.stl", convexity=3);      translate ([-12,0,0]) cube ([10,60,60],center=true);   }  // Create the voids and slot for the LED circuit  translate ([-20,0,0]) rotate ([0,90,0]) cylinder(15,10,10);  translate ([-10,0,0]) rotate ([0,90,0]) cylinder(1.2,14,14);  translate ([-40,0,0]) rotate ([0,90,0]) cylinder(55,4,4); } }if (left) {  difference(){    ModEggEmpty();    translate ([0,-15,0]) cube ([80,30,60],center=true);// Holes for the pegs        translate ([-12,0,-19]) rotate ([90,0,0]) cylinder(10,3.5,3.5,center=true);    translate ([-12,0,19]) rotate ([90,0,0]) cylinder(10,3.5,3.5,center=true);   }// case for the button    difference() {    translate ([-25.5,0,0]) cube ([6,14,14],center=true);     translate ([-26.5,0,0]) cube ([5,12,16],center=true);     translate ([-40,0,0]) rotate ([0,90,0]) cylinder(15,4,4);    translate ([0,-15,0]) cube ([80,30,60],center=true);   }} else {   difference(){    ModEggEmpty();    translate ([0,15,0]) cube ([80,30,60],center=true);        }// Pegs       translate ([-12,0,-19]) rotate ([90,0,0]) cylinder(10,3.3,3.3,center=true);   translate ([-12,0,19]) rotate ([90,0,0]) cylinder(10,3.3,3.3,center=true); // case for the button    difference() {     translate ([-25.5,0,0]) cube ([6,14,14],center=true,\$fn=100);      translate ([-26.5,0,0]) cube ([5,12,16],center=true,\$fn=100);      translate ([-40,0,0]) rotate ([0,90,0]) cylinder(55,4,4, \$fn=100);     translate ([0,15,0]) cube ([80,30,60],center=true);    }}`

In the recycled electronic circuit placed inside the modified egg, the shock switch (a spring surrounded by a metallic gasket) was broken and replaced by a large flat rest push button. Unfortunately, we needed to make also other adjustments as the circuit had other damages. For this reason, we are not reporting many details, as other circuits can be a different story. However, adapting the openSCAD script to your need should not be difficult.

## Step 5: Conclusions

We have presented a program to generate realistic bird egg shapes for 3D printing. The STL files generated by the program can be modified to create egg-based gadgets and toys. We hope this small interactive project gives you a quick dive into the deep waters of geometric shapes in nature and gives you the interest to continue exploring the frontiers. Participated in the
Art Challenge