我曾尝试在 TikZ 中用装饰画一个随机、平滑的椭圆,然后我想出了类似的东西这,但端点不匹配:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}[decoration={random steps,segment length=12.5mm,amplitude=6mm}]
\draw[decorate,rounded corners=4mm] (0,0) ellipse (1.3cm and 2cm);
\end{tikzpicture}
\end{document}
重复构造几次表明,差距是一个系统错误,不是来自随机性:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}[decoration={random steps,segment length=12.5mm,amplitude=6mm}]
\foreach \i in {1,...,10} {\draw[decorate,rounded corners=4mm] (0,0) ellipse (1.3cm and 2cm);}
\end{tikzpicture}
\end{document}
有什么问题?我该如何解决?
答案1
您必须谨慎选择的segment length
尺寸。amplitude
rounded corners
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}[decoration={random steps,segment length=3pt,amplitude=2pt}]
\draw[decorate,rounded corners=1pt] (0,0) ellipse (1.3cm and 2cm);
\end{tikzpicture}
\begin{tikzpicture}[decoration={random steps,segment length=3pt,amplitude=1pt}]
\draw[decorate,rounded corners=1pt] (5,0) ellipse (1.3cm and 2cm);
\end{tikzpicture}
\end{document}