[Tex/LaTex] How to draw an egg using TikZ

funtikz-pgf

I would like to draw an egg-format element, but I have only found ways of drawing ellipses.

Best Answer

Here is the only solution using the perfect (!) parametric equation of an egg (cf. Equation of Egg Shaped Curve) :

  • x = H × 0.78 × cos(t × 0.25) × sin(t)
  • y = H × cos(t)

(where H is the height of the egg and t is in [-π,π])

enter image description here

\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \def\eggheight{3cm}
  \path[ball color=orange!60!gray]
  plot[domain=-pi:pi,samples=100]
  ({.78*\eggheight *cos(\x/4 r)*sin(\x r)},{-\eggheight*(cos(\x r))})
  -- cycle;
\end{tikzpicture}
\end{document}

Edit: a second version with better colors.

enter image description here

\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \def\eggheight{3cm}
  \path[preaction={fill=orange!50!white},
  ball color=orange!60!gray,fill opacity=.5]
  plot[domain=-pi:pi,samples=100]
  ({.78*\eggheight *cos(\x/4 r)*sin(\x r)},{-\eggheight*(cos(\x r))})
  -- cycle;
\end{tikzpicture}
\end{document}