
다음 그림은 보기 흉하고 날카로운 모서리를 생성합니다.
\documentclass[11pt]{scrartcl}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}
\draw[fill=black]
(-2,1) circle (2pt) node (tl) {}
(0,1) circle (2pt) node (tc) {}
(2,1) circle (2pt) node (tr) {}
(-6,0) circle (2pt) node (ll) {}
(-4,0) circle (2pt) node (l) {}
(4,0) circle (2pt) node (r) {}
(6,0) circle (2pt) node (rr) {};
\draw[draw=orange, fill=orange]
(-2,-1) circle (2pt) node (bl) {}
(0,-1) circle (2pt) node (bc) {}
(2,-1) circle (2pt) node (br) {};
\draw[>=latex, ->, thick]
(l) edge (tl)
(r) edge (tr);
\draw[>=latex, ->,thin, orange]
(bl) edge (l)
(br) edge (r);
\draw[>=latex, <->, thick]
(ll) edge (l)
(rr) edge (r)
(tl) edge (tc)
(tc) edge (tr);
\draw[>=latex, <->, orange]
(bl) edge (bc)
(bc) edge (br);
\path[rounded corners=1cm, draw=gray!70]
(-1-6,1) -- (2-6,1) -- (4-6,2) -- (8-6,2) --
(10-6,1) -- (13-6,1) --(13-6,-1) -- (10-6,-1) --
(8-6,0) -- (4-6,0) -- (2-6,-1) -- (-1-6,-1) -- cycle;
\path[rounded corners=1.5cm, draw=gray!50]
(-1-6-0.5,1+0.5) -- (2-6,1+0.5) -- (4-6,2+0.5) --
(8-6,2+0.5) -- (10-6,1+0.5) -- (13-6+0.5,1+0.5) --
(13-6+0.5,-1-0.5) -- (10-6,-1-0.5) -- (8-6,-2-0.5) --
(4-6,-2-0.5) -- (2-6,-1-0.5) -- (-1-6-0.5,-1-0.5) -- cycle;
\end{tikzpicture}
\end{center}
\end{document}
분명히 둥근 모서리는 먼저 둥근 모서리를 계산한 다음 끝점을 직선 세그먼트로 연결합니다. rounded corners=1cm
두 번째 곡선으로 설정하면 문제가 사라집니다 .
들쭉날쭉한 가장자리 없이 더 둥근 모서리를 얻으려면 어떻게 해야 합니까?
답변1
1cm도 너무 커서 확대하면 눈에 띕니다. 그러나 제한된 수의 작업(주로 경로 모핑 작업)의 경우 중괄호 쌍 안에 항목을 넣고 옵션을 제공하여 일시적으로 설정을 변경할 수 있습니다.
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\path[rounded corners=1.5cm, draw=gray!50]
(-1-6-0.5,1+0.5) -- (2-6,1+0.5) {[rounded corners=0.5cm]-- (4-6,2+0.5)} --
(8-6,2+0.5) {[rounded corners=0.1cm]-- (10-6,1+0.5)} -- (13-6+0.5,1+0.5) --
(13-6+0.5,-1-0.5) -- (10-6,-1-0.5) {[rounded corners=0.8cm]--(8-6,-2-0.5)} --
(4-6,-2-0.5) {[rounded corners=0.8cm]--(2-6,-1-0.5)} --(-1-6-0.5,-1-0.5)-- cycle;
\end{tikzpicture}
\end{document}