
Recorté un círculo a lo largo de la línea atan(2/3)
. Donde se recorta el círculo me gustaría poner una flecha. Pensé que sería tan simple como (atan(2/3) + 180)/360
obtener su ubicación porcentual a lo largo del camino. Desafortunadamente, no fue así. Terminé restando 32.5
títulos por ensayo y error. Aunque me gustaría hacer una ubicación más exacta.
\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}
Respuesta1
Analicemos. Sin \clip
rotación y el rectángulo dibujado, este es tu círculo:
Esto muestra que el \percent
valor debería ser 50
. Con
\pgfmathsetmacro{\ppi}{\angle + 180};
\pgfmathsetmacro{\percent}{(\ppi)/360};
Ciertamente no estás dando, 50%
pero más que eso. Para ser exactos, le estás dando atan(2/3)
más \ppi
. Si hacemos \ppi
= 180, entonces \percent
será 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}
Ahora puedes rotar y recortar para obtener:
\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}