# Tikz Fractal - Sierpinski Tiling Arrowhead

Yet another attempt at drawing a fractal using Tikz. I am trying to draw that Sierpinski Tiling Arrowhead: by using L-systems. The one I have found is:

\pgfdeclarelindenmayersystem{SierpLine}{
\symbol{a}{\pgflsystemsetangle{300}}
\symbol{b}{\pgflsystemsetangle{60}}
\rule{X -> YFa+XFa+Y}
\rule{F -> XFb+YFb+X}
}


where a and b are the angles turning. The 'zero-th' iteration is the unit interval and then my image goes all wonky. Can somebody help please?

My code:

\documentclass[border=9,tikz]{standalone}
\usetikzlibrary{lindenmayersystems}
\begin{document}

\pgfdeclarelindenmayersystem{SierpArr}{
\symbol{a}{\pgflsystemsetangle{300}}
\symbol{b}{\pgflsystemsetangle{60}}
\rule{X -> YFa+XFa+Y}
\rule{F -> XFb+YFb+X}
}

\tikz;
\tikz\draw[lindenmayer system={SierpArr,axiom=S,step=80pt,order=1}]lindenmayer system;
\tikz\draw[lindenmayer system={SierpArr,axiom=S,step=80pt,order=2}]lindenmayer system;
\tikz\draw[lindenmayer system={SierpArr,axiom=S,step=80pt,order=3}]lindenmayer system;
\end{document}


This is one of the examples in the manual.

## The output ## The code

\documentclass[border=9,tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{lindenmayersystems}
\begin{document}

\pgfdeclarelindenmayersystem{SierpArr}{
\symbol{X}{\pgflsystemdrawforward}
\symbol{Y}{\pgflsystemdrawforward}
\rule{X -> Y-X-Y}
\rule{Y -> X+Y+X}
}

\foreach \k in {1,...,7}
{
\tikz\draw[lindenmayer system={SierpArr,angle=60,axiom=X,step=200pt/2^\k,order=\k}]lindenmayer system;
}

\end{document}

• That's very nice thank you. I added in a -60 degree turn for the odd orders so they're all pointing 'up'. Thanks :) – JSharpee Aug 18 '17 at 12:29