# A Lindenmayer system case

Obviously the optimal way to make something like this

is the Lindenmayer systems in TikZ.

Here are some attempts of mine, kept per suggestion in a comment.

\documentclass[tikz]{standalone}
\usetikzlibrary{lindenmayersystems}

\begin{document}
\pgfdeclarelindenmayersystem{try}{
\symbol{S}{\pgflsystemstep=.6\pgflsystemstep}
\rule{X -> FS[S-Y]YF}
\rule{Y -> FS[SX-]XF}
}

\begin{tikzpicture}
\draw [rotate=45]
[l-system={try, axiom=X, order=10, step=124pt, angle=90}]
lindenmayer system;
\end{tikzpicture}
\end{document}


\documentclass[tikz]{standalone}
\usetikzlibrary{lindenmayersystems}

\begin{document}
\pgfdeclarelindenmayersystem{try}{
\symbol{S}{\pgflsystemstep=.8\pgflsystemstep}
\rule{X -> FX[-SFY]FX}
\rule{Y -> FY[+FX]FY}
}

\begin{tikzpicture}
\draw [rotate=-45]
[l-system={try, axiom=X, order=7, step=1.2pt, angle=90}]
lindenmayer system;
\end{tikzpicture}
\end{document}


\documentclass[tikz]{standalone}
\usetikzlibrary{lindenmayersystems}

\begin{document}
\pgfdeclarelindenmayersystem{try}{
\symbol{S}{\pgflsystemstep=.67\pgflsystemstep}
\symbol{p}{\draw circle (.01\pgflsystemstep);}
\rule{X -> FS[+S[p]Y]X}
\rule{Y -> FS[S[p]X]Y}
}

\begin{tikzpicture}
\draw [rotate=135]
[l-system={try, axiom=X, order=12, step=140pt, angle=90}]
lindenmayer system;
\end{tikzpicture}
\end{document}


\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{lindenmayersystems}

\begin{document}
\pgfdeclarelindenmayersystem{try}{
\symbol{S}{\pgflsystemstep=.67\pgflsystemstep}
\symbol{p}{\draw circle (.01\pgflsystemstep);}
\rule{X -> [p]FS[-ff++SY]X}
\rule{Y -> [p]FS[+ff--SX]Y}
}

\begin{tikzpicture}
\draw [rotate=45]
[l-system={try, axiom=X, order=12, step=160pt, angle=90}]
lindenmayer system;
\end{tikzpicture}
\end{document}


This is not yet a complete answer but because of the OP's input we may be getting there. What this answer does is to define a rule for the zigzags of decreasing amplitude, and a way to combine them.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{lindenmayersystems}
\def\pgflsystemturnr{%
\pgftransformrotate{-90}}%
\def\pgflsystemturnl{%
\pgftransformrotate{90}}%

\begin{document}
\begin{tikzpicture}[l-system={step=10pt, order=7,angle=165}]
\pgfdeclarelindenmayersystem{pft}{
\symbol{D}{\pgflsystemdrawforward}
\symbol{M}{\pgflsystemmoveforward}
\symbol{S}{\pgflsystemstep=0.9\pgflsystemstep}
\symbol{I}{\pgflsystemstep=1.1\pgflsystemstep}
\symbol{L}{\pgflsystemstep=3\pgflsystemstep}
\symbol{l}{\pgflsystemturnl}
\symbol{r}{\pgflsystemturnr}
\rule{Z -> [Y]-DDDDDSS+Z} % line up zigzag
\rule{Y -> -DI+DI-DI+DI-DI+DI-DI+DI-DI+DI-DI+DI-DI+DI-DI+DI} % zigzag
}
\draw [red,rotate=-60] (0,0) l-system [l-system={pft, axiom=Z, anchor=south west}];
\end{tikzpicture}
\end{document}


Using this one can get something that resembles your screen shot.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{lindenmayersystems}
\def\pgflsystemturnr{%
\pgftransformrotate{-90}}%
\def\pgflsystemturnl{%
\pgftransformrotate{90}}%
\newcounter{lmn}
\begin{document}
\begin{tikzpicture}[l-system={step=10pt, order=8,angle=165},line join=bevel,
pics/linden row/.style={code={\draw[shorten >=-#1*0.05cm] (0,0) -- (-142.5:2*#1)
foreach \XX in {1,...,#1} {coordinate[pos={pow(0.75,\XX-1)}] (p-#1-\XX)
node[circle,fill,pos={1.02*pow(0.75,\XX-1)},scale={pow(0.75,\XX-1)}]{}};
\foreach \XX in {1,...,#1}
{\draw[rotate=-57.5] (p-#1-\XX)
l-system [l-system={pft,step={pow(0.8,-#1+2*\XX+5)*4pt}, axiom=Z, anchor=west}];}}}]
\pgfdeclarelindenmayersystem{pft}{
\symbol{D}{\pgflsystemdrawforward}
\symbol{M}{\pgflsystemmoveforward}
\symbol{S}{\pgflsystemstep=0.9\pgflsystemstep}
\symbol{I}{\pgflsystemstep=1.1\pgflsystemstep}
\symbol{L}{\pgflsystemstep=3\pgflsystemstep}
\symbol{l}{\pgflsystemturnl}
\symbol{r}{\pgflsystemturnr}
\symbol{o}{\stepcounter{lmn}%
\pgfnode{coordinate}{center}{\pgfpointorigin}{X\number\value{lmn}}{}}%
\symbol{c}{\pgfpathlineto{\pgfpointanchor{X\number\value{lmn}}{center}}}
\rule{Z -> [Y]-DDDDDSS+Z} % line up zigzag
\rule{Y -> rMl-Do[rD]I+DI-DI+DI-DI+DI-DI+DI-DI+DI-DI+DI-DI+DI-DI[c]+DI} % zigzag
}
\path foreach \X in {4,5,...,8} {(-30:{pow(1.2,\X)*6cm}) pic{linden row=\X}};
\end{tikzpicture}
\end{document}


• The obvious way to fix it would be to use [...] but this causes dimension too large errors. – user194703 Oct 26 '19 at 22:58
• Does not decreasing step help with "dimension too large"? – მამუკა ჯიბლაძე Oct 27 '19 at 9:27
• No, - I cannot figure out where to put the [...]. As for the size - it is OK as long as enough detail is visible – მამუკა ჯიბლაძე Oct 27 '19 at 9:36
• (note that in my second attempt step is quite small) – მამუკა ჯიბლაძე Oct 27 '19 at 9:53
• @მამუკაჯიბლაძე Now there is something that vaguely resembles your screen shot. The outer repetition is done in an explicit loop, the main reason being that I do not know if it is possible to have a Lindenmayer system repeat something n times, where n varies. – user194703 Oct 27 '19 at 11:47

Here is a code coming reasonably close to it.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{lindenmayersystems}

\begin{document}
\pgfdeclarelindenmayersystem{try}{
\symbol{S}{\pgflsystemstep=.67\pgflsystemstep}
\symbol{p}{\draw circle (.01\pgflsystemstep);}
\rule{X -> [p]S[-FF++SY]Xf}
\rule{Y -> [p]S[+FF--SX]Yf}
}

\begin{tikzpicture}
\draw [rotate=45]
[l-system={try, axiom=X, order=12, step=280pt, angle=90}]
lindenmayer system;
\end{tikzpicture}
\end{document}


Whether it can be made better, I don't know, so I will leave this unaccepted in case somebody may further improve it