
Ich habe einen Kreis entlang der Linie abgeschnitten atan(2/3)
. An der Stelle, an der der Kreis abgeschnitten ist, möchte ich einen Pfeil platzieren. Ich dachte, es wäre so einfach, wie die prozentuale Position entlang des Pfads zu ermitteln. Leider war das nicht der Fall. Durch Ausprobieren (atan(2/3) + 180)/360
habe ich am Ende Grad abgezogen . Ich möchte jedoch eine genauere Platzierung vornehmen.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}
Antwort1
Lassen Sie uns analysieren. Ohne \clip
, ohne Drehung und das gezeichnete Rechteck ist dies Ihr Kreis:
Dies zeigt, dass der \percent
Wert sein sollte 50
. Mit
\pgfmathsetmacro{\ppi}{\angle + 180};
\pgfmathsetmacro{\percent}{(\ppi)/360};
Sie geben sicherlich nicht 50%
mehr als das. Genauer gesagt geben Sie atan(2/3)
mehr an \ppi
. Wenn wir \ppi
= 180 machen, dann \percent
wird sein 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}
Jetzt können Sie drehen und ausschneiden, um Folgendes zu erhalten:
\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}