# How to randomly fill an area with daisies in TikZ

As in this question I would like to randomly fill an area, but not with simple dots, with more complex shapes (daisies).

Here is what I've done so far (suggestions for more beautiful daisies are also welcome):

If it was possible, I would like to randomly put more big daisies at the top of the area and less at the bottom, vice-versa for little daisies and, as for the middle ones, more in the center and less at the top and at the bottom.

EDIT: more and more difficult: I'd like to avoid clipped daisies on the border and overlapping ones.

MWE:

\documentclass[tikz, preview=true, border=0.4cm]{standalone}
\usetikzlibrary{decorations.pathmorphing}

\newcommand{\daisy}[3]% scale, 1st coord, 2nd coord
{%
\begin{scope}[transform canvas={scale=#1}]]%
\draw [fill=white,decorate,decoration={coil,aspect=-1,segment length=4.13mm}] (#2,#3) circle (.4cm);
\node[circle, fill=yellow, draw=red] (center) at (#2,#3) {};%
\end{scope}%
}%

\begin{document}‎

\begin{tikzpicture}
\fill[green,rounded corners=1mm]  (0,10) -- (5,15) -- (11,14) -- (14,11) -- (15,5) -- (10,0) -- (1,1) -- cycle;
\daisy{1.5}{5}{7}
\daisy{1}{7}{7}
\daisy{.7}{10}{7}
\end{tikzpicture}%

\end{document}

• put \daisy{random number} in a foreach loop? – percusse Nov 4 '16 at 19:36

Not sure if this is exactly what is required, but it shows how the the size of the daisies can be altered according to their vertical position over an arbitrary filling area:

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{calc}
\tikzset{pics/daisy/.style={code={
\foreach \i in {0,30}\foreach \j in {0,60,...,300}
\path [draw=gray, fill=white, rotate=\i+\j]
(0,0) .. controls ++(-30:1/2) and ++(30:1/2) .. cycle;
}},
daisy fill/.style={fill=green, path picture={
\pgfnodealias{@}{path picture bounding box}% For convenience.
\foreach \i [evaluate={\x=rnd; \y=rnd; \s=0.25+rnd+\y;}] in {0,...,100}
\path ($(@.west)!\x!(@.east)$) coordinate (@1)
($(@.south)!\y!(@.north)$) coordinate (@2)
(@1 |- @2) pic [scale=\s] {daisy};
}}}
\begin{document}
\begin{tikzpicture}
\path [daisy fill]
(0,10) -- (5,15) -- (11,14) -- (14,11) --
(15,5) -- (10,0) -- (1,1) -- cycle;
\end{tikzpicture}
\end{document}


• Yes, this is exactly what I required! The only little thing that I don't like is the clipped daisies on the border, I'll wait a couple of days for possible other answers, then I'll accept yours! – CarLaTeX Nov 4 '16 at 20:19
• This seems quite difficult. Maybe using path picture bounding box.center, and then draw rays form there and finding the interception point with the path, and drawing a random daisy with a size that guarantee it will not go outside... but I can't find a way to reference the current path from inside the path picture. – Rmano Nov 5 '16 at 10:51
• @Rmano I image it is too difficult, don't worry, Mark's answer is already excellent! – CarLaTeX Nov 5 '16 at 14:42
• @CarLaTeX avoiding overlapping daisies requires something like poisson sampling (see here for examples including daisies). Avoiding clipping would 'simply' involve adding extra conditions to the acceptance criteria for points in the sampling algorithm. – Mark Wibrow Nov 6 '16 at 10:00
• @Rmano with \makeatletter\tikzset{save path/.code={\tikz@addmode{\pgfgetpath#1}}} the use of \path [daisy fill, save path=\daisypath] ... would provide a macro \daisypath which is available inside the path picture. – Mark Wibrow Nov 6 '16 at 10:03