TikZ: 장식을 사용하여 잘린 경로 장식하기

TikZ: 장식을 사용하여 잘린 경로 장식하기

선을 따라 원을 잘라냈습니다 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}

여기에 이미지 설명을 입력하세요

관련 정보