就像这样问题我想随机填充一个区域,但不是用简单的点,而是用更复杂的形状(雏菊)。
这是我目前所做的(也欢迎对更多美丽的雏菊提出建议):
如果可能的话,我想随机地在区域的顶部放置较多的大雏菊,在底部放置较少的雏菊,反之亦然,至于中间的雏菊,在中心放置较多的雏菊,在顶部和底部放置较少的雏菊。
编辑:越来越困难:我想避免在边界上剪掉雏菊并使其重叠。
梅威瑟:
\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}
答案1
不确定这是否正是所需要的,但它展示了如何根据雏菊在任意填充区域上的垂直位置来改变其大小:
\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;
\path [draw=orange, fill=yellow] circle [radius=1/8];
}},
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}