
我沿著線剪了一個圓圈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)
的更多\ppi
。如果我們使\ppi
= 180,那麼\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}