원 안의 광선

원 안의 광선

에 게시된 것과 동일한 그림을 만들려고 합니다.여기(답글 참조) 그러나 (0,0)이 아닌 다른 지점을 중심으로 합니다. 어떠한 제안?

답변1

확신하는. 중심점이 될 좌표를 정의하고 이를 먼저 모든 명령에 지정한 다음 +각 좌표 앞에 를 추가합니다. 더하기 기호는 더하기 기호가 없는 좌표를 기준으로 다음 좌표를 만듭니다. 이는 정확히 원하는 것입니다. 중심이 실제로 더 이상 존재하지 않고 정의된 좌표(A)에 있음을 증명하기 위해 (0,0)에 빨간색 원을 추가한 Heiko의 수정된 코드를 참조하세요.

\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usepackage{siunitx}
\begin{document}
\begin{tikzpicture}
    \coordinate (A) at (1,1);
  \def\Radius{2.5cm}
  \draw
    \foreach \a in {10, 20, ..., 350} {
      (A) -- +(\a:\Radius)
    }
    +(0, 0) circle[radius=\Radius]
    %
    +(0, 0) -- +(0:3.75cm)
    +(0, 0) -- +(10:3.75cm)
    %
    +(5:4cm) node {\SI{10}{\degree}}
    +(-30:3.7cm) node {\SI{360}{\degree}}
  ;

  \def\Radius{3.5cm}
  \draw[->]
    (A)
    +(0:\Radius) arc[start angle=0, end angle=10, radius=\Radius]
  ;

  \def\Radius{3cm}
  \draw[->]
    (A)
    +(0:\Radius)
    arc[start angle=0, end angle=180, radius=\Radius]
    arc[start angle=180, end angle=360, radius=\Radius]
  ;
    \fill [red] (0,0) circle (2pt);
\end{tikzpicture}
\end{document}

위 코드의 결과를 보여주는 이미지

답변2

여기에 또 다른 가능성이 있습니다. pic그 후에 원하는 위치에 배치할 수 있는 a 를 정의하세요. 이는 휠을 여러 번 배치해야 하는 경우에만 유용합니다.

\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usepackage{siunitx}
\tikzset{
  wheel/.pic={
    \def\Radius{2.5cm}
    \draw
      \foreach \a in {10, 20, ..., 350}{
        (0,0) -- +(\a:\Radius)
      }
      (0, 0) circle[radius=\Radius]
      (0, 0) -- +(0:3.75cm)
      (0, 0) -- +(10:3.75cm)
      (5:4cm) node {\SI{10}{\degree}}
      (-30:3.7cm) node {\SI{360}{\degree}}
    ;

    \def\Radius{3.5cm}
    \draw[->]
      (0:\Radius) arc[start angle=0, end angle=10, radius=\Radius]
    ;

    \def\Radius{3cm}
    \draw[->]
      (0:\Radius)
      arc[start angle=0, end angle=180, radius=\Radius]
      arc[start angle=180, end angle=360, radius=\Radius]
    ;
  }
}

\begin{document}
\begin{tikzpicture}
  \fill[orange] (-1,-1) rectangle (11,3);
  \path  (0,0) pic{wheel} (10,0) pic{wheel};
\end{tikzpicture}
\end{document}

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

관련 정보