Skip to content
scipython.com

Egg shape formula

Posted on

The universal formula for egg shape of Narushin et al. (2021) gives the profile of a bird's egg, from circular to pyriform (pear-shaped), in terms of four measurements: its length, its maximum breadth, the position of the maximum breadth and its diameter a quarter of its length from the pointed end. This post introduces the formula, shows that it is a weighted average of two simpler profiles and implements it in Python to draw the profiles of four eggs and the surface of a pyriform egg.

Narushin et al. [Ann. N.Y. Acad. Sci. 1505, 169–177 (2021), doi:10.1111/nyas.14680] give a formula for the profile of a bird's egg that covers the four classes of egg shape they consider: circular, elliptical, oval and pyriform (pear-shaped, with one end much more pointed than the other). Pyriform eggs are laid by, among other birds, the common guillemot and Brünnich's guillemot, each of which lays a single egg on a bare cliff ledge. The shape was long thought to make the egg roll in an arc, rather than off the ledge, when it is knocked; Birkhead et al. found instead that pyriform eggs are more stable on the sloping ledges on which guillemots often breed [The Auk 135, 1020–1032 (2018), doi:10.1642/AUK-18-38.1].

Formula

The formula, equation (5) of the article, is

\[\begin{aligned} y = \pm\frac{B}{2}&\sqrt{\frac{L^2 - 4x^2}{L^2 + 8wx + 4w^2}} \\ &\times\left(1 - \frac{\sqrt{5.5L^2 + 11Lw + 4w^2}\left(\sqrt{3}BL - 2D_{L/4}\sqrt{L^2 + 2wL + 4w^2}\right)}{\sqrt{3}BL\left(\sqrt{5.5L^2 + 11Lw + 4w^2} - 2\sqrt{L^2 + 2wL + 4w^2}\right)}\right. \\ &\times\left.\left[1 - \sqrt{\frac{L\left(L^2 + 8wx + 4w^2\right)}{2(L - 2w)x^2 + \left(L^2 + 8Lw - 4w^2\right)x + 2Lw^2 + L^2w + L^3}}\right]\right) \end{aligned}\]

where \(x\) is the position along the long axis of the egg, measured from its centre, from \(-L/2\) at the blunt end to \(L/2\) at the pointed end, and \(y\) is the distance of the profile from this axis. \(L\) is the length of the egg, \(B\) its breadth at \(x = -w\) and \(D_{L/4}\) its diameter at \(x = L/4\), a distance \(L/4\) from the pointed end; these are marked in the figure below.

Equation (5) is a weighted average of two simpler profiles (Supplementary Material S3 of the article): Hügelschäffer's model of an ovoid egg, \(y_\mathrm{H}\), which is an ellipse when \(w = 0\) (the first line of equation (5), and equation (1) of the article), and a pyriform profile, \(y_\mathrm{c}\) (equation (3) of the article):

\[y = (1 - k)\,y_\mathrm{H} + k\,y_\mathrm{c}, \qquad k = \frac{D_\mathrm{H} - D_{L/4}}{D_\mathrm{H} - D_\mathrm{c}},\]

where \(D_\mathrm{H}\) and \(D_\mathrm{c}\) are the diameters of the two profiles at \(x = L/4\).

Show derivationHide derivation

The two profiles are

\[\begin{aligned} y_\mathrm{H} &= \pm\frac{B}{2}\sqrt{\frac{L^2 - 4x^2}{L^2 + 8wx + 4w^2}},\\ y_\mathrm{c} &= \pm\frac{B}{2}\sqrt{\frac{L\left(L^2 - 4x^2\right)}{2(L - 2w)x^2 + \left(L^2 + 8Lw - 4w^2\right)x + 2Lw^2 + L^2w + L^3}}. \end{aligned}\]

The square root in the last line of equation (5) is therefore \(y_\mathrm{c}/y_\mathrm{H}\) and, if the fraction in its second line is written \(k\), equation (5) is

\[y = y_\mathrm{H}\left[1 - k\left(1 - \frac{y_\mathrm{c}}{y_\mathrm{H}}\right)\right] = (1 - k)\,y_\mathrm{H} + k\,y_\mathrm{c}.\]

At \(x = L/4\), the denominator of the fraction in \(y_\mathrm{c}\) is \(\tfrac{L}{4}\left(5.5L^2 + 11Lw + 4w^2\right)\), and the diameters of the two profiles are

\[D_\mathrm{H} = \frac{\sqrt{3}BL}{2\sqrt{L^2 + 2wL + 4w^2}}, \qquad D_\mathrm{c} = \frac{\sqrt{3}BL}{\sqrt{5.5L^2 + 11Lw + 4w^2}}.\]

Dividing the numerator and the denominator of \(k\) by \(2\sqrt{5.5L^2 + 11Lw + 4w^2}\sqrt{L^2 + 2wL + 4w^2}\) gives \(k = (D_\mathrm{H} - D_{L/4})/(D_\mathrm{H} - D_\mathrm{c})\).

The weight \(k\) gives the egg the diameter \(D_{L/4}\) at \(x = L/4\): \(k = 0\) gives Hügelschäffer's model and \(k = 1\) the pyriform profile. The formula is intended for \(0 \le k \le 1\), i.e. \(D_\mathrm{c} \le D_{L/4} \le D_\mathrm{H}\), and for \(0 \le w \le (L - B)/2\), beyond which Hügelschäffer's model no longer resembles an egg. Both profiles have the breadth \(B\) at \(x = -w\). This is the maximum breadth of Hügelschäffer's model, but the pyriform profile is up to 2.2% broader, a little closer to the blunt end.

An egg outline, blunt at the left and pointed at the right, drawn as a solid curve, with dashed and dotted curves that coincide with it towards the blunt end and lie just outside and just inside it towards the pointed end. Vertical arrows labelled B and D sub L/4 span the egg at x = −w, where it is broadest, and at x = L/4. The axis below is marked at −L/2, −w, 0, L/4 and L/2.
The profiles given by equation (5) for \(k = 0\) (Hügelschäffer's model), \(k = 1/2\) and \(k = 1\) (the pyriform profile), for \(B = 0.58L\) and \(w = 0.17L\), with the parameters of the formula marked on the profile for \(k = 1/2\).

Implementation

The program below implements equation (5) as this weighted average, and raises an error if \(k\) is not between 0 and 1. It draws the profiles of four eggs, one of each class of shape, and the surface of the pyriform egg, made by rotating its profile about the \(x\)-axis, since an egg is a solid of revolution about its long axis.

egg_shapes.py
"""The profiles of birds' eggs, from the universal formula for egg shape of
Narushin et al., Ann. N.Y. Acad. Sci. 1505, 169 (2021), doi:10.1111/nyas.14680.

x is the position along the long axis of the egg, measured from its centre,
from -L/2 at the blunt end to L/2 at the pointed end; L is the length of the
egg, B its breadth at x = -w and DL4 its diameter at x = L/4.
"""

import matplotlib.pyplot as plt
import numpy as np


def y_hugelschaffer(x, L, B, w):
    """Hügelschäffer's model of an ovoid egg, equation (1) of the article."""
    return B / 2 * np.sqrt((L**2 - 4 * x**2) / (L**2 + 8 * w * x + 4 * w**2))


def y_pyriform(x, L, B, w):
    """The pyriform profile, equation (3) of the article."""
    P = (2 * (L - 2 * w) * x**2 + (L**2 + 8 * L * w - 4 * w**2) * x
         + 2 * L * w**2 + L**2 * w + L**3)
    return B / 2 * np.sqrt(L * (L**2 - 4 * x**2) / P)


def y_egg(x, L, B, w, DL4):
    """The universal egg profile, equation (5) of the article: the weighted
    average of equations (1) and (3) whose diameter at x = L/4 is DL4."""
    DH = 2 * y_hugelschaffer(L / 4, L, B, w)
    Dc = 2 * y_pyriform(L / 4, L, B, w)
    k = (DH - DL4) / (DH - Dc)
    if not 0 <= k <= 1:
        raise ValueError(f"DL4 must lie between {Dc:.4g} and {DH:.4g}.")
    return (1 - k) * y_hugelschaffer(x, L, B, w) + k * y_pyriform(x, L, B, w)


def plot_profile(ax, x, y, **kwargs):
    """Draw the profile y(x) and its mirror image as one closed outline."""
    ax.fill(np.concatenate((x, x[-2:0:-1])), np.concatenate((y, -y[-2:0:-1])),
            fill=False, **kwargs)


# B, w and DL4, in units of L, for eggs of the four classes of shape.
EGGS = {
    "Circular": (1, 0, np.sqrt(3) / 2),
    "Elliptical": (0.7, 0, 0.6),
    "Oval": (0.75, 0.05, 0.6),
    "Pyriform": (0.58, 0.17, 0.37),
}

L = 1
# The points are closer together towards the ends of the egg, where the
# profile is steepest.
x = -L / 2 * np.cos(np.linspace(0, np.pi, 200))

if __name__ == "__main__":
    fig, axes = plt.subplots(nrows=2, ncols=2)
    for ax, (name, (B, w, DL4)) in zip(axes.flat, EGGS.items()):
        plot_profile(ax, x, y_egg(x, L, B, w, DL4), ec="k", lw=1.5)
        ax.set_aspect("equal")
        ax.axis("off")
        ax.set_title(name)
    plt.show()

    # The egg is a solid of revolution about the x-axis: its surface is made
    # by rotating the profile of the pyriform egg through 2π about this axis.
    B, w, DL4 = EGGS["Pyriform"]
    phi = np.linspace(0, 2 * np.pi, 100)
    X, Phi = np.meshgrid(x, phi)
    R = y_egg(X, L, B, w, DL4)
    Y, Z = R * np.cos(Phi), R * np.sin(Phi)

    fig = plt.figure()
    ax = fig.add_subplot(projection="3d")
    ax.plot_surface(X, Y, Z, color="r", alpha=0.3, rstride=10, cstride=10)
    ax.plot_wireframe(X, Y, Z, color="k", rstride=10, cstride=10, lw=1)
    # Equal limits and a cubic box give the three axes the same scale.
    for set_lim in (ax.set_xlim, ax.set_ylim, ax.set_zlim):
        set_lim(-L / 2, L / 2)
    ax.set_box_aspect((1, 1, 1), zoom=1.6)
    ax.axis("off")
    plt.show()
Four outlines in a two-by-two grid, titled Circular, Elliptical, Oval and Pyriform: a circle; an ellipse; an egg shape, blunt at the left and more pointed at the right; and a pear shape that tapers sharply to a point at the right.
Profiles of eggs of the four classes of shape, drawn by the program. Narushin et al. give as examples the eggs of the Ural owl (circular), emu (elliptical), song thrush and osprey (oval) and Brünnich's guillemot (pyriform). The pyriform egg has the proportions of the guillemot's egg in Fig. 3 of the article (\(B = 0.58L\), \(w = 0.17L\)); the others are illustrative.
A pear-shaped egg drawn in three dimensions as a translucent surface covered by a mesh of rings and meridians, blunt at the left and pointed at the right.
The surface of the pyriform egg, made by rotating its profile about the \(x\)-axis.

Comments

Leave a comment

Optional, and never shown: only the moderator sees it.

Comments are written in Markdown (code between ``` lines) and appear once approved. Your name and comment are published; your email address, if you give one, is seen only by the moderator.