
교수님께서는 LaTeX에서 Prim의 알고리즘에 대한 증명을 작성하셨고 그래프를 사용하여 잘라내기가 어떻게 이루어지는지 설명하셨습니다. 제가 궁금한 것은 가운데 원에서 나오는 물결선을 어떻게 만드셨는가입니다.
https://www.uncg.edu/cmp/faculty/srate/330.f16/primsproof.pdf
이것이 어떻게 이루어졌는지 설명할 수 있는 사람이 있나요? 그것을 논문으로 재현하고 싶습니다. 감사해요!
답변1
환영! 부드러운 곡선을 그리는 방법에는 여러 가지가 있습니다. smooth
또는 와 함께 플롯을 사용 smooth cycle
하거나 in
및 out
등을 사용할 수 있습니다.
\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[bullet/.style={circle,fill,inner sep=1.4pt}]
\draw[semithick] plot[smooth cycle,looseness=1.3] coordinates
{(0,1) (0.5,0.7) (1.2,0.9) (2,1.3) (2.5,1.2) (3.6,1.1) (3.7,2.2)
(3,3.2) (1.6,2.9) (0.3,2.5) };
\draw[semithick]
(1,1.7) node{$W$}
(2.8,2.6) node[bullet,label=above left:$a$](a){}
(a) +(20:1.2) node[bullet,label=above right:$b$](b){}
(2.8,1.5) node[bullet,label=left:$x$](x){}
(x) +(-10:1.2) node[bullet,label=below right:$y$](y){}
(x) to[out=60,in=-60] (3,1.9) to[out=120,in=-120] (a)
-- (b) to[out=-80,in=90] (3.4,1.9)
to[out=-90,in=100] (y) -- (x);
\end{tikzpicture}
\end{document}
물결선을 그리려면 장식을 사용하면 됩니다 coil
.
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}[bullet/.style={circle,fill,inner sep=1.4pt,outer sep=0pt}]
\draw[semithick] plot[smooth cycle,looseness=1.3] coordinates
{(0,1) (0.5,0.7) (1.2,0.9) (2,1.3) (2.5,1.2) (3.6,1.1) (3.7,2.2)
(3,3.2) (1.6,2.9) (0.3,2.5) };
\draw[semithick]
(1,1.7) node{$W$}
(2.8,2.6) node[bullet,label=above left:$a$](a){}
(a) +(20:1.2) node[bullet,label=above right:$b$](b){}
(2.8,1.5) node[bullet,label=left:$x$](x){}
(x) +(-10:1.2) node[bullet,label=below right:$y$](y){}
(a)
-- (b) to[out=-80,in=90] (3.4,1.9)
to[out=-90,in=100] (y) -- (x);
\draw[thick,blue,decorate,decoration={coil,aspect=0,segment length=5.9mm}] (x) -- (a);
\end{tikzpicture}
\end{document}
더 멋진 물결선을 찾을 수 있습니다.여기.