Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
1  
Have a look at this beautiful logo: tex.stackexchange.com/questions/43739/… –  percusse Sep 26 '12 at 12:43
6  
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. –  Kurt Sep 26 '12 at 12:44
7  
@Kurt I think you meant "Please add a picture example that illustrates what you want to achieve" ? –  tohecz Sep 26 '12 at 12:59
5  
@tohecz: both: what has he tried until now (show the code) and what want he to achieve (illustrate, I think, includes both, or am I wrong?). –  Kurt Sep 26 '12 at 13:05
3  
@naught101: Not necessarily. It would be interesting to know whether the OP simply wants an egg-shaped path, or an egg-shaped node with anchors, what parameters they want to specify, how realistic they want it to be. Typically, a question as vague as this wouldn't get a whole lot of answers, it's just that this particular one is pretty fun, maybe even because it's so open. I do think that Kurt was right to ask for more information, though. –  Jake Sep 27 '12 at 15:46

10 Answers 10

up vote 70 down vote accepted
+100

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}
share|improve this answer
4  
Mathematical! This answer is totally algebraic! :) –  El Andi Oct 30 '12 at 2:47
1  
@ElAndi Actually, it's transcendental. But you can get puns from there too. –  WChargin Feb 17 at 15:36

The to[in=angle,out=angle] and ball shading constructs are helpful for this:

Code

\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[looseness=0.75,ball color=orange!70!gray] (-2,0) arc (180:360:2) to[out=90,in=0] (0,3) to[out=180,in=90] (-2,0) -- cycle;
\end{tikzpicture}
\end{document}

Result

enter image description here


Edit 1: I think this pudding is overegged.

Code

\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[looseness=0.9,ball color=orange!70!gray!50,draw=none] (-2,0) arc (180:360:2) to[out=90,in=0] (0,3) to[out=180,in=90] (-2,0) -- cycle;
\end{tikzpicture}
\end{document}

Result

enter image description here


Edit 2: Following percusse's idea, I added a few freckles:

Code

\documentclass[tikz,border=5mm]{standalone}

\begin{document}

\begin{tikzpicture}
    \colorlet{myEgg}{orange!70!gray!50}
    \draw[looseness=0.9,ball color=orange!70!gray!50,draw=none,clip] (-2,0) arc (180:360:2) to[out=90,in=0] (0,3) to[out=180,in=90] (-2,0) -- cycle;
    %\fill[blue] (-3,-3) rectangle (3,3);
    \foreach \x in {1,...,100}
    {   \pgfmathsetmacro{\rDot}{random()/50}
        \pgfmathsetmacro{\xCoo}{rand*2}
        \pgfmathsetmacro{\yCoo}{rand*2.5+0.5}
        \pgfmathsetmacro{\dColor}{100-60*sqrt(pow(\xCoo+0.5,2)+pow(\yCoo-1.4,2))/2.6}
        \fill[myEgg!\dColor!black] (\xCoo,\yCoo) circle (\rDot);
    }
\end{tikzpicture}

\end{document}

Result

enter image description here


Edit 3: special request of ガベージコレクタ: here's 512 frog spawn (immersed in water):

Code

\documentclass[tikz,border=5mm]{standalone}
\usepackage{xifthen}
\usepackage{fp}

\newcommand{\frogegg}[2]%
{ \draw[ball color=black!80] (#1) circle (#2*0.25cm);
    \draw[ball color=cyan!5!gray,opacity=0.1] (#1) circle (#2*1cm);
}

\pgfdeclarelayer{background layer}
\pgfsetlayers{background layer,main}

\begin{document}

\begin{tikzpicture}
[   x={(-27:1cm)},
    y={(203:1cm)},
    z={(95:1cm)},
]
\foreach \x in {0,...,7}
{ \foreach \y in {0,...,7}
    {   \foreach \z in {0,...,7}
        {   \pgfmathsetmacro{\xco}{\x+rand/3}
            \pgfmathsetmacro{\yco}{\y+rand/3}
            \pgfmathsetmacro{\zco}{\z+rand/3}
            \pgfmathsetmacro{\rad}{1+rand/3}
            \frogegg{\xco,\yco,\zco}{\rad}
        }
    }
}
\begin{pgfonlayer}{background layer}
    \fill[blue!50!gray] (current bounding box.south west) rectangle (current bounding box.north east);
\end{pgfonlayer}
\end{tikzpicture}

\end{document}

Result

enter image description here

share|improve this answer
4  
It's a bit too "triangular"; compare to psdgraphics.com/file/brown-egg.jpg –  egreg Sep 26 '12 at 13:06
2  
Is this an organic egg? –  Marc van Dongen Sep 26 '12 at 15:58
3  
@MarcvanDongen: How to distinguish eggs. –  cyanide-based food Sep 26 '12 at 17:00
7  
I can't tell the difference between the speckles on your egg and the ones on my monitor! –  Quinn Culver Sep 27 '12 at 0:52
1  
Thank you for the frog eggs. –  cyanide-based food Sep 27 '12 at 17:29

A quick fix for egreg's egg. Thank you MATLAB for running so slow.

I've tried to find a dirt mask but couldn't find anything which would give a more realistic result. Also the shadow shading is a little off but the original render is also wrong.

\documentclass[tikz]{standalone}
\usetikzlibrary{shadings}
\definecolor{eggshell}{RGB}{252,230,201}
\pgfdeclareradialshading{eggshading}{\pgfpoint{1cm}{1cm}}%
{color(0cm)=(eggshell!80);
color(0.5cm)=(brown!75!eggshell);
color(0.7cm)=(brown);
color(0.9cm)=(brown!70!black);
color(1.2cm)=(black)
}
\pgfdeclareradialshading{eggshadow}{\pgfpointorigin}%
{color(0cm)=(black);
color(2mm)=(gray!80);
color(3mm)=(gray!40);
%color(0.3cm)=(black!5!white);
color(7mm)=(white)
}

\begin{document}
\begin{tikzpicture}
\begin{scope}[yscale=0.93,transform shape]
    \node[xscale=2,yscale=0.3,shading=eggshadow,circle,minimum size=7mm] at (0,2.75mm){};
    \shade[shading=eggshading] (0,2.7mm)..controls (9mm,0.25cm) and (7mm,2cm)%
    ..(0,20.5mm)..controls(-7mm,2cm) and (-9mm,2.5mm)..(0,2.7mm)--cycle;
\end{scope}
    \node[anchor=south] at (2,0) {\includegraphics[height=2cm]{brownegg}};
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
5  
I didn't look at the implementation but I think the egg to the right is the best of all eggs presented thus far. –  Marc van Dongen Sep 26 '12 at 20:04
2  
@MarcvanDongen Oh sorry to disappoint you that was the image that egreg linked to. I was merely trying to replicate on the left. –  percusse Sep 27 '12 at 1:36
2  
@percusse Thanks, I see. Now that we know how to draw the egg, perhaps it's time for the question How to draw a bird laying an egg? –  Marc van Dongen Sep 27 '12 at 4:12
    
Great! But I'm wondering how the egg stands upright without cracked shell at the bottom? ;) –  schmendrich Sep 27 '12 at 5:54
2  
@schmendrich It's boiled and spinning, hence it stays upright from the conservation of the angular momentum. :P –  percusse Sep 27 '12 at 11:51

Since it is time... some Easter eggs:

enter image description here

The code:

\documentclass{article}
\usepackage{tikz,charter}
\usetikzlibrary{hobby,
  shapes.geometric,
  decorations,
  decorations.shapes,
  shapes.geometric,
  patterns
}

% http://www.guitex.org/home/it/forum/5-tex-e-latex/83195-la-libreria-hobby-tikz-non-funziona-piu#83203
\ExplSyntaxOn
\cs_if_exist:NF \prg_stepwise_function:nnnN { \cs_gset_eq:NN \prg_stepwise_function:nnnN \int_step_function:nnnN }
\cs_if_exist:NF \prg_stepwise_inline:nnnn { \cs_gset_eq:NN \prg_stepwise_inline:nnnn \int_step_inline:nnnn }
\ExplSyntaxOff

\makeatletter
\pgfdeclareradialshading[tikz@ball]{easter bg}{\pgfpoint{5bp}{25bp}}{%
color(0cm)=(tikz@ball!20);
color(0.15cm)=(tikz@ball!30);
color(0.4cm)=(tikz@ball!60);
color(0.9cm)=(tikz@ball)
}
\tikzoption{easter bg color}{\pgfutil@colorlet{tikz@ball}{#1}\def\tikz@shading{easter bg}\tikz@addmode{\tikz@mode@shadetrue}}


\pgfkeys{/tikz/easter star/.code args={#1 and #2}{
  \pgfdeclareradialshading[tikz@ball]{easter star}{\pgfpoint{#1}{#2}}{%
  color(0cm)=(tikz@ball!20);
  color(0.3cm)=(tikz@ball!40);
  color(0.65cm)=(tikz@ball!60);
  color(1cm)=(tikz@ball)
  }
 }
 \tikzoption{easter star color}{\pgfutil@colorlet{tikz@ball}{#1}\def\tikz@shading{easter star}\tikz@addmode{\tikz@mode@shadetrue}}
}

\makeatother

% original code by Paul Gaborit:
% tex.stackexchange.com/questions/72784/arrow-with-two-colors-with-tikz/#72793
\tikzset{
  double path/.style args={#1 colored by #2 and #3}{
    -,line join=round,line cap=rect,
    shorten >=0.1cm,
    shorten <=0.1cm,
    line width=#1,#2, % first path
    postaction={draw,-,#3,line width=(#1)/1.5,  
                shorten <=(#1)/3,shorten >=(#1)/3,
    }, % second path
  }
}

\tikzset{easter decoration 1/.style={
    decorate,
    decoration={
      shape backgrounds,
      shape=star,shape size=7pt,
      shape sep={0.5cm, between center},      
    },
    inner color=yellow,
    outer color=yellow!50!orange,
    draw=red!20!orange,
  }
}


\pgfdeclarepatternformonly{fivepointed stars easter 2}{\pgfpointorigin}{\pgfpoint{10mm}{10mm}}{\pgfqpoint{10mm}{8mm}}%
{
  \pgftransformshift{\pgfqpoint{1mm}{1mm}}
  \pgfpathmoveto{\pgfqpointpolar{18}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{162}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{306}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{90}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{234}{1mm}}
  \pgfpathclose%
  \pgfusepath{fill}
}

\tikzset{easter decoration 3/.style={
    draw=green!17!yellow,
    line width=2pt,
    star,
  }
}

\pgfdeclarepatternformonly{fivepointed stars easter 3}{\pgfpointorigin}{\pgfpoint{12mm}{12mm}}{\pgfqpoint{12mm}{11mm}}%
{
  \pgftransformshift{\pgfqpoint{1mm}{1mm}}
  \pgfpathmoveto{\pgfqpointpolar{18}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{162}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{306}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{90}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{234}{1mm}}
  \pgfpathclose%
  \pgfusepath{fill}
}

% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

\begin{document}
% Easter Egg 1
\begin{tikzpicture}[use Hobby shortcut]
    \node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Easter Egg 1};
    % path clipping
    \clip[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
    % shading
    \shade[easter bg color=orange,scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;

    % colored paths
    \draw[double path=5pt colored by orange!80!yellow and yellow,scale=-6] (0.775,0.35) .. (0.735,0.35)  .. (0.65,0.3) .. (0.45,0.4) .. (0.235,0.355) .. (0.225,0.35);
    \draw[double path=5pt colored by orange!80!yellow and yellow,scale=-6] (0.9,0.5) .. (0.775,0.55)  .. (0.55,0.5) .. (0.45,0.6) .. (0.235,0.55) .. (0.1,0.5);
    \draw[double path=5pt colored by orange!80!yellow and yellow,scale=-6] (0.9,0.7) .. (0.775,0.75)  .. (0.55,0.7) .. (0.45,0.8) .. (0.235,0.75) .. (0.1,0.7);

    % stars
    \draw[easter decoration 1,scale=-6] (0.775,0.25) .. (0.735,0.25)  .. (0.65,0.2) .. (0.45,0.3) .. (0.235,0.255) .. (0.225,0.25);
    \draw[easter decoration 1,scale=-6] (0.9,0.4) .. (0.775,0.45)  .. (0.55,0.4) .. (0.45,0.5) .. (0.235,0.45) .. (0.1,0.4);
    \draw[easter decoration 1,scale=-6] (0.9,0.6) .. (0.775,0.65)  .. (0.55,0.6) .. (0.45,0.7) .. (0.235,0.65) .. (0.1,0.6);
    \draw[easter decoration 1,scale=-6] (0.9,0.8) .. (0.775,0.85)  .. (0.55,0.8) .. (0.45,0.9) .. (0.235,0.85) .. (0.1,0.8);

    % draw again the border
    \draw[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
\end{tikzpicture}
% Easter Egg 2
\begin{tikzpicture}[use Hobby shortcut]
    \node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Easter Egg 2};
    % path clipping
    \clip[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
    % shading
   \draw[easter bg color=blue!65!cyan,scale=-6,postaction={pattern=fivepointed stars easter 2,pattern color=blue}](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;

    \begin{scope}[transform canvas={shift={(-3.5,-3.5)}}]
    \node[star,scale=2.25,easter star=2bp and 10bp, easter star color=cyan!65!blue] at (0.35,0.75){};
    \node[star,scale=1.5,easter star=-2bp and 15bp, easter star color=cyan!85!blue,rotate=10] at (1.45,1.45){};

    \node[star,scale=1.5,easter star=5bp and 10bp, easter star color=cyan!75!blue,rotate=-10] at (-0.5,1.95){};

    \node[star,scale=1.65,easter star=5bp and 15bp, easter star color=cyan!45!blue,rotate=-5] at (-0.75,-0.85){};

    \node[star,scale=1.7,easter star=5bp and 15bp, easter star color=cyan!37!blue,rotate=-3] at (0,-1.65){};

    \node[star,scale=1.5,easter star=5bp and 10bp, easter star color=cyan!60!blue,rotate=2] at (0.85,-0.65){};

    \node[star,scale=1.75,easter star=-2bp and 2bp, easter star color=cyan!60!blue,rotate=14] at (2,0){};     

    \end{scope}
    % draw again the border
    \draw[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
\end{tikzpicture}
% Easter Egg 3
\begin{tikzpicture}[use Hobby shortcut]
    \node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Easter Egg 3};
    % path clipping
    \clip[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
    % shading
   \draw[easter bg color=green!77!blue,scale=-6,postaction={pattern=fivepointed stars easter 3,pattern color=green!20!yellow}](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;

    \begin{scope}[transform canvas={shift={(-3.5,-3.5)}}]
    \node[easter decoration 3,scale=2.25] at (0.55,0.65){};
    \node[easter decoration 3,scale=1.5,rotate=10] at (1.45,1.45){};

    \node[easter decoration 3,scale=1.5,rotate=-10] at (-0.5,1.95){};

    \node[easter decoration 3,scale=1.65,rotate=-5] at (-0.75,-0.70){};

    \node[easter decoration 3,scale=1.7,rotate=-3] at (0,-1.65){};

    \node[easter decoration 3,scale=1.5,rotate=2] at (0.85,-0.65){};

    \node[easter decoration 3,scale=1.75,rotate=14] at (2,0){};     

    \end{scope}
    % draw again the border
    \draw[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
\end{tikzpicture}

\end{document}

I'm joining late the party unfortunately... I noticed that the OP didn't specified of which animal we should draw the egg, thus my answer.

\documentclass{article}
\usepackage{tikz,charter}
\usetikzlibrary{hobby,shapes.geometric,decorations,decorations.pathmorphing}

% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

% frigde egg (please don't consider my fridge as an animal :D )
\definecolor{eggl}{HTML}{F6AD7A}
\definecolor{eggli}{HTML}{E0996D}
\definecolor{egglii}{HTML}{D38C62}
\definecolor{eggliii}{HTML}{C37B53}
\definecolor{eggliiii}{HTML}{B56D45}
\definecolor{colfreckles}{HTML}{C78054}

\pgfdeclareradialshading{fridgeegg}{\pgfqpoint{5bp}{5bp}}{%
 color(0bp)=(eggl);
 color(11bp)=(eggli);
 color(19bp)=(egglii);
 color(25bp)=(eggliii);
 color(50bp)=(eggliiii)}

% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

% duck egg
\definecolor{duckeggl}{HTML}{F4F3EF}
\definecolor{duckeggli}{HTML}{F1EDEA}
\definecolor{duckegglii}{HTML}{E2D5CD}
\definecolor{duckeggliii}{HTML}{AD9070}
\definecolor{duckeggliiii}{HTML}{7E5330}
% Important: no freckles visible

\pgfdeclareradialshading{duckegg}{\pgfqpoint{-11bp}{15bp}}{%
 color(0bp)=(duckeggl);
 color(8bp)=(duckeggli);
 color(20bp)=(duckegglii);
 color(37bp)=(duckeggliii);
 color(50bp)=(duckeggliiii)} 

% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

% quail egg
\definecolor{quaileggl}{HTML}{CAB8A2}
\definecolor{quaileggli}{HTML}{BFB399}
\definecolor{quailegglii}{HTML}{AE9B7D}
\definecolor{quaileggliii}{HTML}{90846C}
\definecolor{quaileggliiii}{HTML}{70644C}
\definecolor{quailcolfreckles}{HTML}{221F28}

\pgfdeclareradialshading{quailegg}{\pgfqpoint{11bp}{15bp}}{%
 color(0bp)=(quaileggl);
 color(10bp)=(quaileggli);
 color(20bp)=(quailegglii);
 color(30bp)=(quaileggliii);
 color(50bp)=(quaileggliiii)} 

 % freckles
\definecolor{frecklesl}{HTML}{7B6140}
\definecolor{frecklesli}{HTML}{79767F}
\definecolor{freckleslii}{HTML}{5D5455}
\definecolor{frecklesliii}{HTML}{3C373E}
\definecolor{frecklesliiii}{HTML}{25242C}

 \pgfdeclareradialshading{frecklesshading}{\pgfqpoint{4bp}{2bp}}{%
 color(0bp)=(frecklesl);
 color(2bp)=(frecklesli);
 color(5bp)=(freckleslii);
 color(10bp)=(frecklesliii);
 color(15bp)=(frecklesliii)} 

% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

\begin{document}
\begin{tikzpicture}[use Hobby shortcut]
% Fridge Egg
    \node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Fridge Egg};
    \shade[shading=fridgeegg,scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
    \foreach \i in {0,...,50}{
    \pgfmathrandom{2,3}
    \pgfmathsetmacro\myxshift{(\pgfmathresult*rnd)+2}
    \pgfmathrandom{2,4.5}
    \pgfmathsetmacro\myyshift{(\pgfmathresult*rnd)+1.5}
    \draw[xshift=-\myxshift cm,yshift=-\myyshift cm,scale=0.3,colfreckles,fill=colfreckles] (0mm,0mm)--++(\pgfmathresult*0.1 mm,1mm)--++(\pgfmathresult*0.1 mm,\pgfmathresult*0.1 mm)--++(\pgfmathresult*0.1 mm,-\pgfmathresult*0.1 mm)--cycle;
    }
\end{tikzpicture}
\begin{tikzpicture}[use Hobby shortcut]
% Duck Egg
    \node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Duck Egg};
    \shade[shading=duckegg,scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
\end{tikzpicture}
$\quad$
\begin{tikzpicture}[use Hobby shortcut]
% Duck Egg
    \node[above,xshift=-2cm,yshift=1.5cm] at (0.5,1){Quail Egg};
    \shade[shading=quailegg,scale=-3](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
    \foreach \i in {0,...,45}{
    \pgfmathrandom{1.90,1.975}
    \pgfmathsetmacro\myxshift{(\pgfmathresult*rnd)+1.05}
    \pgfmathrandom{2.90,2.98}
    \pgfmathsetmacro\myyshift{(\pgfmathresult*rnd)+0.725}
    \pgfmathrnd
    \draw[xshift=-\myxshift cm,yshift=-\myyshift cm,scale=0.2,quailcolfreckles,fill=quailcolfreckles] (0mm,0mm)--++(\pgfmathresult*0.1 mm,1mm)--++(\pgfmathresult*0.1 mm,\pgfmathresult*0.1 mm)--++(\pgfmathresult*0.1 mm,-\pgfmathresult*0.1 mm)--cycle;
    }
    % further freckles
    \node[draw=none,rounded corners,    thick,ellipse,shading=frecklesshading,
    xshift=-2cm,yshift=-1cm,
    decorate,decoration={random steps,segment length=3mm,amplitude=1mm}] {};
    \node[draw=none,rounded corners,    thick,ellipse,shading=frecklesshading,
    xshift=-1.3cm,yshift=-1.5cm,
    decorate,decoration={random steps,segment length=5mm,amplitude=4mm}] {};
    \node[draw=none,rounded corners,    thick,ellipse,shading=frecklesshading,
    xshift=-1.6cm,yshift=-2.5cm,
    decorate,decoration={bent}] {};
    \node[draw=none,rounded corners,    thick,ellipse,shading=frecklesshading,
    xshift=-1.9cm,yshift=-2cm,
    decorate,decoration={bent}] {};
\end{tikzpicture}
\end{document}

enter image description here


Just for fun (hope Paulo doesn't mind):

\documentclass{beamer}
\renewcommand*\sfdefault{augie}
\renewcommand*\familydefault{\sfdefault}
\usepackage[T1]{fontenc}
\usepackage{tikz,etoolbox}

\input{pc-duck}
\usetikzlibrary{hobby,decorations,decorations.pathmorphing}

\begin{document}
\begin{frame}{True Story}
\begin{tikzpicture}[use Hobby shortcut]
\foreach \step in {1,...,8}{
\pgfmathtruncatemacro\currstep\step
    \ifnumodd{\currstep}{%true
    \draw<\currstep>[scale=-5,inner color=white,outer color=gray!5,rotate=-10] (0.5,0.1) .. (0.7,0.28) .. (0.5,1) .. (0.3,0.28) .. (0.5,0.1) .. cycle;
    }{%false
    \draw<\currstep>[scale=-5,inner color=white,outer color=gray!5,rotate=10] (0.5,0.1) .. (0.7,0.28) .. (0.5,1) .. (0.3,0.28) .. (0.5,0.1) .. cycle;
    }
}
\foreach \step in {4,...,8}{
\pgfmathtruncatemacro\currstep\step
\pgfmathsetmacro\adv{0.175*\step}
\ifnumodd{\currstep}{%true
    \draw<\currstep>[xshift=-4cm,yshift=-1.5cm,rotate=-15]decorate[decoration=zigzag] {(0,0) -- (\adv,0)};
    }{%false
    \draw<\currstep>[xshift=-3.3cm,yshift=-3cm,rotate=15]decorate[decoration=zigzag] {(0,0) -- (\adv,0)};
    }
}
\draw<9>[scale=-5,inner color=white,outer color=gray!5] (0.5,0.1) .. (0.7,0.28) .. (0.5,1) .. (0.3,0.28) .. (0.5,0.1) .. cycle;
\draw<9>[xshift=-3.7cm,yshift=-2.2cm]decorate[decoration=zigzag] {(0,0) -- (1.9,0)};
\end{tikzpicture}
\visible<10>{\drawduck}
\end{frame}
\end{document}

enter image description here

share|improve this answer
2  
The birth of a duck! Epic! –  egreg Sep 29 '12 at 13:44
2  
Oh my, I want to upvote this answer ten times! :) –  Paulo Cereda Sep 29 '12 at 13:59
1  
Awesome! :-)) (of course, I +1'd it.) –  kan Sep 29 '12 at 14:59
    
Thanks to everybody :) –  Claudio Fiandrino Sep 30 '12 at 14:38
    
A reference to find the hobby package: Where in the world is tikzlibraryhobby.code.tex? –  Claudio Fiandrino Dec 10 '12 at 13:28

A broken egg with PSTricks.

enter image description here

\documentclass[pstricks,border=12pt]{standalone}
\begin{document}
\begin{pspicture}(4.5,4.5)
    \pscircle*[linecolor=orange](2,2){1}
    \psccurve(0.5,0.5)(0.25,2)(1,3)(2,4)(4,4)(4.5,3)(4,1)(0.8,0.2)(0.5,0.5)
\end{pspicture}
\end{document}

Animated version:

on the frying pan...

enter image description here

\documentclass[pstricks]{standalone}
\usepackage{pst-node,pst-plot}

\begin{document}
\pstVerb{realtime srand}%
\psLoop{25}{%
\begin{pspicture}(-2,-2)(2,2)
    \pscircle*[linecolor=orange]{0.75}
    \curvepnodes[plotpoints=73]{0}{360}{rand 101 mod 1000 div 1.50 add t PtoC}{P}
    \def\points{}%
    \multido{\i=0+1}{\Pnodecount}{\xdef\points{\points (P\i)}}
    \expandafter\psccurve\points
\end{pspicture}}
\end{document}
share|improve this answer
2  
Next on the list: amlet! –  Harish Kumar Sep 26 '12 at 15:06
3  
I can't keep up with your name changes! –  cmhughes Sep 26 '12 at 15:11
2  
I think ガベージコレクタ needs to have another on the end: ガベージコレクター. That's the usual pattern anyway. –  LarsH Sep 26 '12 at 17:52
3  
@ガベージコレクタ: Ay lad, that's the daily reputation limit. As I see it you're at 24 upvotes, of which only 20 are counted. –  Tom Bombadil Sep 26 '12 at 21:37
1  
@TomBombadil: Oh my ghost. I did know that restriction. Thank you! –  cyanide-based food Sep 26 '12 at 21:48

With PGFPlots:

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}

\begin{document}
%
\begin{tikzpicture}
\begin{axis}[
    hide axis, clip=false,
    y domain=0:2*pi,
    samples=30,axis equal, view={45}{20}]

\addplot3 [domain=-1:1,surf,z buffer=sort,shader=flat,fill=brown!80!yellow, draw=black!20!brown, join=round] 
    ({sqrt(1-x^2)*cos(deg(y))},
     {sqrt(1-x^2)*sin(deg(y))},
     {sqrt(x+2.2)*x});

\end{axis}
\end{tikzpicture}%
%
\end{document}
share|improve this answer
3  
oooh, a parameterized egg! –  Benedikt Bauer Sep 26 '12 at 13:28

hobby time:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}[use Hobby shortcut]
\draw[scale=-1,inner color=white,outer color=gray!5] (0.5,0.1) .. (0.7,0.28) .. (0.5,1) .. (0.3,0.28) .. (0.5,0.1) .. cycle;
\end{tikzpicture}
\end{document}

enter image description here

Adding some color:

\PassOptionsToPackage{svgnames}{xcolor}
\documentclass{standalone}
\usepackage{tikz}

\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}[use Hobby shortcut]
\draw[draw=none,scale=-3,ball color=orange!50!gray,] (0.5,0.1) .. (0.7,0.28) .. (0.5,1) .. (0.3,0.28) .. (0.5,0.1) .. cycle;
\end{tikzpicture}
\end{document}

enter image description here

Somebody spun this egg and it is spinning due to the inertia of inside fluids (a fresh egg ;-) indeed):

enter image description here

share|improve this answer
    
That's a camshaft for valve timing :P. –  percusse Oct 28 '12 at 23:22
    
It is worth wasting 806.39KB for this animation. –  cyanide-based food Oct 31 '12 at 14:44
    
Note that the .. cycle syntax no longer works with hobby. See tex.stackexchange.com/a/121310/86 for more details (and how to fix it). –  Loop Space Jul 9 '13 at 8:00
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{hobby}

\begin{document}
\begin{tikzpicture}[use Hobby shortcut]
\draw (0,0) .. (1,3) .. ([tension=1.4]0,4) .. (-1,3) .. cycle;
\end{tikzpicture}
\end{document}

A Hobby Egg

Update To show-off the hobby a little more, here's a second version. I took the egg that egreg linked to and found some points on its boundary then used those as the inputs to the Hobby algorithm. The left-hand egg is the original egg with the control points shown in red and the path shown in black. The right-hand egg is the same path shifted over and then filled with the same fill as in Tom Bombadill's answer (sans freckles).

Code:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{hobby}

\begin{document}
\begin{tikzpicture}[use Hobby shortcut]
    \node[anchor=south west,inner sep=0] (image) at (0,0)
{\includegraphics[width=.9\textwidth]{brown-egg.jpg}};
    \begin{scope}[x={(image.south east)},y={(image.north west)}]
\useasboundingbox (-.1,-.1) rectangle (2.1,1.1);
\fill[red,c/.style={insert path={circle[radius=5pt]}}]
  (0.5,0) [c] coordinate (a)
  (.965,.3) [c] coordinate (b)
  (.865,.8) [c] coordinate (bb)
  (0.5,.998) [c] coordinate (c)
  (.135,.8) [c] coordinate (dd)
  (.04,.3) [c] coordinate (d);
\draw[ultra thick,postaction={transform canvas={shift={(1,0)}},ball
color=orange!70!gray}] (a) .. (b) .. (bb) .. (c) .. (dd) .. (d) ..
cycle;
    \end{scope}
\end{tikzpicture}
\end{document}

(The image is the egg picture cropped to the egg.)

Result:

More accurate egg

share|improve this answer
4  
Harish is better with hobby than you. –  egreg Sep 26 '12 at 13:21
4  
@egreg My excuse is that I was using a development version and my egg had a bug in it which I had to squash first before posting (wouldn't do to have eggs with bugs in them, now, would it?). –  Loop Space Sep 26 '12 at 13:22
    
The .. cycle syntax no longer works with hobby. See tex.stackexchange.com/a/121310/86 for more details and how to fix it. –  Loop Space Jul 9 '13 at 8:00

Did you mean something like this:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \draw (0,0) 
    .. controls (0,-1.5) and (2,-1.5).. (2,0)
    .. controls (2,2.5) and (0,2.5) .. (0,0);
\end{tikzpicture}
\end{document}

Maybe the exact shape needs some tweaking but the way to go should be clear.

enter image description here

share|improve this answer

Sorry for be late to this egg party, but I think that is interesting to show you another way to draw an egg celebrating this New Year!

In order to reproduce the egg, I only draw a special closed polygonal that looks like a smooth curve: a "subdivision curve". A subdivision scheme is an iterative way to obtain curves or surfaces by mean of refinements of polygons or meshes in the respective cases. If you wish that the final polygonal (obtained in the last iteration) looks more smooth, you should consider make another iteration (e.g, a fourth iteration in this case). For this sketch, the subdivision scheme that I choose was the one to get a cubic B-Spline and only made 3 iterations. (By the way, thanks to everyone who help me in my question Using \foreach loop in Cubic B-spline curve refinement).

This is my code (feel free to improve it):

\documentclass[margin={1.5cm 0pt}]{standalone}

\usepackage{pgf,tikz}

\newcommand{\sscubicBS}[1]{
\def\count{#1}
    \pgfmathtruncatemacro{\lasti}{\count+1}
    \pgfmathtruncatemacro{\lastii}{\count+2}
    \coordinate (p\lasti) at (p1);
    \coordinate (p\lastii) at (p2);
    \coordinate (p0) at (p\count);

    \foreach \i  in {1,...,\count} {%
        \pgfmathtruncatemacro{\j}{\i+1}%
        \pgfmathtruncatemacro{\k}{\i+2}%
        \pgfmathtruncatemacro{\even}{2*\i-1}%
        \pgfmathtruncatemacro{\odd}{2*\i}%
        \coordinate (n\even) at (barycentric cs:p\i=0.5,p\j=0.5);
        \coordinate (n\odd) at (barycentric cs:p\i=0.125,p\j=0.75,p\k=0.125);
        }

    \pgfmathtruncatemacro{\count}{2*\count}

    \foreach \i in {1,...,\count} {
        \coordinate (p\i) at (n\i);
        }
}

\begin{document}

\begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (image) at (0,0)
{\includegraphics[width=.5\textwidth]{brown-egg.jpg}};

\begin{scope}[x={(image.south east)},y={(image.north west)}]
    \useasboundingbox (-.1,-.1) rectangle (2.1,1.1);
    \fill[blue,c/.style={insert path={circle[radius=5pt]}}] %control points
      (0.31,-.01) [c] coordinate (p1)
      (0.69,-.01) [c] coordinate (p2)
      (1.01,.25) [c] coordinate (p3)
      (1.01,.68) [c] coordinate (p4)
      (0.69,1.01) [c] coordinate (p5)
      (0.31,1.01) [c] coordinate (p6)
      (-.01,.68) [c] coordinate (p7)
      (-.01,.25) [c] coordinate (p8);

    \def\count{8}
    % control polygon
    \draw[line width=1pt,blue] (p1) \foreach \p in {2,...,\count} {-- (p\p)} -- cycle;

    \sscubicBS{8} % first iteration 
    \sscubicBS{16} % second iteration
    \sscubicBS{32} % third iteration
%   \sscubicBS{64} % fourth iteration

    \draw[line width=1pt,black,postaction={transform canvas={shift={(1.3,0)}},draw=red}] (p1) \foreach \i in {2,...,\count}{-- (p\i)} -- cycle;
\end{scope}
\end{tikzpicture}

\end{document}

As @AndrewStacey, I took the egg that @egreg provided (left egg) and created a (symmetric) control polygon (blue points and blue polygon) as the inputs to the subdivision scheme that generates the egg in right side (the same as the black boundary in the egreg's egg). If you create a mesh as mesh of revolution of this control polygon and use it as input of the Catmull-Clark subdivision scheme for surface you will get the egg in 3D!

enter image description here

I didn't add any color to my egg, but feel free to add the color and shading that you wish ;-)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.