答案1
怎么样
\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[declare function={rr=1+0.1*rnd;}]
\draw plot[smooth cycle,variable=\t,samples at={0,45,...,315}] (\t:2*rr);
\end{tikzpicture}
\end{document}
您可以将其制作成图片,从而制作像振幅或样本数这样的“随机性”参数。
\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[pics/random circle/.style={code={
\tikzset{random circle/.cd,#1}
\def\pv##1{\pgfkeysvalueof{/tikz/random circle/##1}}%
\pgfmathsetmacro{\nextt}{360/\pv{samples}}
\pgfmathsetmacro{\lastt}{360-\nextt}
\draw plot[smooth cycle,variable=\t,samples at={0,\nextt,...,\lastt}]
(\t:\pv{radius}+rnd*\pv{amplitude});
}},random circle/.cd,radius/.initial=1,amplitude/.initial=0.1,
samples/.initial=8]
\path (0,0) pic{random circle}
(4,0) pic[blue]{random circle={radius=2,amplitude=0.3,samples=12}}
(0,-4) pic[red]{random circle={radius=2,amplitude=0.5,samples=16}};
\end{tikzpicture}
\end{document}