TikZ의 0이 아닌 규칙에 대한 질문

TikZ의 0이 아닌 규칙에 대한 질문

TikZ가 어떻게 작동하는지 도움이 필요해요nonzero rule공장. 어떤 지점에서 시작하여 광선이 교차하는 횟수를 센다고 합니다. 그만큼fill삼각형과 원의 공식 예삼각형과 원 사이의 교차점이 채워지지 않았기 때문에 나를 잃었습니다.

이를 이해하기 위해 해당 예를 적용하고 두 개의 원으로 구성된 두 번째 예를 추가했습니다.

\begin{document}
\begin{tikzpicture}
  \filldraw[fill=yellow]
    % Clockwise isoceles right-angled triangle
    (0,0) -- (1,1) -- (2,0) --cycle
    % Small circle centered on the leftmost vertex
    (0,0) circle (.5);

  \draw[->] (0,0) -- (.3,.3);
  \draw[->] (1,1) -- (1.5,.5);
  \draw[->] (2,0) -- (1,0);
  \draw[->] (120:.5) arc (120:90:.5);
  \draw[->] (300:.5) arc (300:270:.5);

  \draw[->] (.2,.1) -- +(0,1) node[above] {crossings: $1+1 = 2$};

  \begin{scope}[yshift=-3cm]
    \filldraw[fill=yellow]
      % Two circles
      (0,0) circle (.5)
      (.5,0) circle (.5);

      \draw[->] (120:.5) arc (120:90:.5);
      \draw[->] (300:.5) arc (300:270:.5);
      \draw[->] (120:.5)+(.5,0) arc (120:90:.5);
      \draw[->] (300:.5)+(.5,0) arc (300:270:.5);
      
    \draw[->] (.2,.1) -- +(0,1) node[above] {crossings: $1+1 = 2$};
  \end{scope}
\end{tikzpicture}
\end{document}

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

다음 내용을 이해하는 데 어려움이 있습니다.

  1. 첫 번째 예에서는 교차 부분이 채워지지 않았습니다.
  2. 두 번째 예에서는 교차 부분이 채워집니다.

교차 횟수가 동일하기 때문입니다. 왜 그런 일이 일어나는지 설명해 주시겠습니까?

답변1

원의 그리기 방향을 반전시켜 수정했습니다.[x radius=-\r, y radius=\r]

\documentclass[tikz, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
\filldraw[fill=yellow]
(0,0) -- (1,1) -- (2,0) --cycle
(0,0) circle[x radius=-0.5, y radius=0.5];
\draw[->] (0,0) -- (.3,.3);
\draw[->] (1,1) -- (1.5,.5);
\draw[->] (2,0) -- (1,0);
\draw[->] (120:.5) arc (120:90:.5);
\draw[->] (300:.5) arc (300:270:.5);
\draw[->] (.2,.1) -- +(0,1) node[above] {crossings: $1+1 = 2$};
\begin{scope}[yshift=-3cm]
\filldraw[fill=yellow]
(0,0) circle[x radius=-0.5, y radius=0.5]
(.5,0) circle[x radius=-0.5, y radius=0.5];
\draw[->] (120:.5) arc (120:90:.5);
\draw[->] (300:.5) arc (300:270:.5);
\draw[->] (120:.5)+(.5,0) arc (120:90:.5);
\draw[->] (300:.5)+(.5,0) arc (300:270:.5);
\draw[->] (.2,.1) -- +(0,1) node[above] {crossings: $1+1 = 2$};
\end{scope}
\end{tikzpicture}
\end{document}

채워진 원과 삼각형이 있는 다이어그램

관련 정보