
線に沿って円を切り取りましたatan(2/3)
。円が切り取られた場所に矢印を配置したいと思います。(atan(2/3) + 180)/360
パスに沿ったパーセンテージ位置を取得するのと同じくらい簡単だと思いました。残念ながらそうではありませんでした。試行錯誤の結果、度数を減算することになりました32.5
。ただし、より正確な配置を行いたいと思います。
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\angle}{atan(2/3)};
\pgfmathsetmacro{\ppi}{\angle + 180};
\pgfmathsetmacro{\percent}{(\ppi - 32.5)/360};
\begin{scope}[rotate = \angle, decoration = {
markings,
mark = at position \percent with {\arrow{stealth}}
}]
\clip (0, .4) rectangle (-.45, 0);
\draw[postaction = decorate] (cylinder) circle[radius = .395cm];
\end{scope}
\end{tikzpicture}
\end{document}
答え1
分析してみましょう。\clip
回転なしで、描かれた長方形なしで、これがあなたの円です:
これは、\percent
値が であるべきであることを示しています50
。
\pgfmathsetmacro{\ppi}{\angle + 180};
\pgfmathsetmacro{\percent}{(\ppi)/360};
50%
確かに、それ以上のを与えているわけではありません。正確に言うと、atan(2/3)
にさらに多くを与えているのです。 = 180\ppi
とすると、になります。\ppi
\percent
50
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\angle}{atan(2/3)};
\pgfmathsetmacro{\ppi}{180};
\pgfmathsetmacro{\percent}{(\ppi)/360};
\begin{scope}[rotate = 0, decoration = {% % change rotate to \angle
markings,
mark = at position \percent with {\arrow{stealth}}
}]
%\clip (0, .4) rectangle (-.45, 0);
\draw (0, .4) rectangle (-.45, 0);
\draw[postaction = decorate] (0,0) circle[radius = .395cm];
\end{scope}
\end{tikzpicture}
\end{document}
これで、回転してクリップすると次のようになります。
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\angle}{atan(2/3)};
\pgfmathsetmacro{\ppi}{180};
\pgfmathsetmacro{\percent}{(\ppi)/360};
\begin{scope}[rotate = \angle, decoration = {
markings,
mark = at position \percent with {\arrow{stealth}}
}]
\clip (0, .4) rectangle (-.45, 0);
%\draw (0, .4) rectangle (-.45, 0);
\draw[postaction = decorate] (0,0) circle[radius = .395cm];
\end{scope}
\end{tikzpicture}
\end{document}