
次の図をabセグメントなしで描くより良い方法はありますか?私は次のコードを使用しました
\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}[scale=5.5]
\node[regular polygon, regular polygon sides=6, minimum size=10cm, rounded corners, draw] at (0,0) {};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Erase ab segment
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw[ultra thick, white](-.377,.787025) -- (.377,.787025);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw(.377,.787025)arc(276:90:.06);
\draw(-.377,.787025)arc(-96:90:.06);
\def\mypath{(-.06,-.98) -- (-.06,-.95) arc (180:0:.06cm) -- (.06,-.98)}
\foreach \t in {0,120,240} {\draw [rotate=\t] \mypath;}
\def\mypath{(0,.98) -- (0,.98) arc (90:55.5:.98cm)}% -- (0,0)}
\draw [rotate=56.5] \mypath;
\def\mypath{(0,.98) -- (0,.98) arc (90:55.5:.98cm)}% -- (0,0)}
\draw [rotate=-22] \mypath;
\def\mypath{(0,.98) -- (0,.98) arc (90:-23:.98cm)}% -- (0,0)}
\draw [rotate=176.5] \mypath;
\def\mypath{(0,.98) -- (0,.98) arc (90:-23:.98cm)}% -- (0,0)}
\draw [rotate=296.5] \mypath;
\end{tikzpicture}
\end{document}
答え1
ノードを適切なパスに置き換えるだけです。六角形の外接円の直径は、スケールなしで 10cm であることがわかっています (オプションを使用するとノードはスケールされないためscale
)。したがって、六角形の外接円のスケールされた半径は 5cm / 5.5 です。
上部の 2 つの半円の開始点と終了点の座標もわかっています。したがって、\draw
極座標を使用してノード シェイプのアウトラインを簡単に再作成できます。
次のコード例では、コードを少し簡略化し、現在の構文に合わせて更新しました。
\documentclass[tikz,border=5]{standalone}
%\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}[scale=5.5]
% \node[regular polygon, regular polygon sides=6, minimum size=10cm, rounded corners, draw] at (0,0) {};
\draw[rounded corners] (-.377,.787025) -- (120:{5/5.5}) -- (180:{5/5.5}) -- (240:{5/5.5}) -- (300:{5/5.5}) -- (360:{5/5.5}) -- (60:{5/5.5}) -- (.377,.787025);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Erase ab segment
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \draw[ultra thick, white](-.377,.787025) -- (.377,.787025);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw(.377,.787025) arc[start angle=276, end angle=90, radius=.06];
\draw(-.377,.787025) arc[start angle=-96, end angle=90, radius=.06];
\def\mypath{(-.06,-.98) -- (-.06,-.95) %
arc[start angle=180, end angle=0, radius=.06] -- (.06,-.98)}
\foreach \t in {0,120,240} {
\draw[rotate=\t] \mypath;
}
\def\mypath{(0,.98) -- (0,.98) arc[start angle=90, end angle=55.5, radius=.98]}
\draw[rotate=56.5] \mypath;
\draw[rotate=-22] \mypath;
\def\mypath{(0,.98) -- (0,.98) arc[start angle=90, end angle=-23, radius=.98cm]}
\draw[rotate=176.5] \mypath;
\draw[rotate=296.5] \mypath;
\end{tikzpicture}
\end{document}