
回答からこの質問; 次のコードを使用して別の十字を描画しました。
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{}
\begin{tikzpicture}[line join=round, line cap=round]
\def\edge{
(.5,.5) to [out=90,in=-90] ++ (0,1.05) to [out=0,in=-90] ++ (.52,.52) to [out=90,in=0] ++ (-.52,.52) to [out=90,in=0] ++ (-.52,.52) to [out=180,in=90] ++ (-.52,-.52) to [out=-180,in=90] ++ (-.52,-.52) to [out=-90,in=180] ++ (.52,-.52) to [out=-90,in=90] ++ (0,-1.05)}
\draw[line width=.1cm,blue, fill=blue!40!white, opacity=.6] (.5,.5) foreach \i in {0,90,180,270}{[rotate=\i] -- \edge} -- cycle;
\end{tikzpicture}
\end{frame}
\end{document}
[line join=round, line cap=round]
を使用すると、行の末尾が長くなることに気付きました。このオプションを省略すると、行の結合があまり魅力的ではなくなります。
line join=round
延長部分を生成せずに、線の端を丸くするにはどのように使用できますか。
答え1
これはあなたのコード内の単純な計算エラーです。確かに、パスは点から始まります(.5,.5)
が、半円の半径は であり.52
、終わらない座標点 における十字の最初の 4 分の 1 です。の(-.5,.5)
半径を に置き換えることで、問題は解決します。不要な操作をいくつか削除して、コードを若干簡素化していることに注意してください。.52
.5
to
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{}
\begin{tikzpicture}[line join=round, line cap=round]
\def\edge{
(.5,.5) -- ++ (0,1.05) to [out=0,in=-90] ++ (.5,.5) to [out=90,in=0] ++ (-.5,.5) to [out=90,in=0] ++ (-.5,.5) to [out=180,in=90] ++ (-.5,-.5) to [out=-180,in=90] ++ (-.5,-.5) to [out=-90,in=180] ++ (.5,-.5) -- ++ (0,-1.05)}
\draw[line width=.1cm,blue, fill=blue!40!white, opacity=.6] (.5,.5) foreach \i in {0,90,180,270}{[rotate=\i] -- \edge}--cycle;
\end{tikzpicture}
\end{frame}
\end{document}
答え2
のコードは\edge
短縮できますとてもあまり長くならないよう、この短縮によって問題も自動的に解決されます。また、transparency group
境界に 2 つの色が表示されるのを避けるために、 を使用することをお勧めします。
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{}
\begin{tikzpicture}[line join=round, line cap=round]
\def\edge{
(.5,.5) -- ++ (0,1.05)foreach \j in {0,90,180} {to [out=\j,in=\j,looseness=1.6] ++ (\j+90:1)}}
\begin{scope}[transparency group,opacity=.6]
\draw[line width=.1cm,blue, fill=blue!40!white] (.5,.5) foreach \i in {0,90,180,270}{[rotate=\i] -- \edge} -- cycle;
\end{scope}
\end{tikzpicture}
\end{frame}
\end{document}
答え3
手動でシフトするのは悪です! ノードのラベル付けを使用する最も適切なソリューション (より保守しやすい) があるはずですが、そのようなソリューションを描くほど詳しくありませんtikz
。その間、次の方法を試すことができます。
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{}
\begin{tikzpicture}[line join=round, line cap=round]
\def\edge{
(.5,.5) to [out=90,in=-90] ++ (0,1.05) to [out=0,in=-90] ++ (.5,.5) to [out=90,in=0] ++ (-.5,.5) to [out=90,in=0] ++ (-.5,.5) to [out=180,in=90] ++ (-.5,-.5) to [out=-180,in=90] ++ (-.5,-.5) to [out=-90,in=180] ++ (.5,-.5) to [out=-90,in=90] ++ (0,-1.05)}
\draw[line width=.1cm,blue, fill=blue!40!white, opacity=.6] (.5,.5) foreach \i in {0,90,180,270}{[rotate=\i] -- \edge} -- cycle;
\end{tikzpicture}
\end{frame}
\end{document}