1

I am trying to create the same figure as the one posted in here (see reply) but centered around a different point than (0,0). Any suggestion?

  • 2
    Welcome to TeX.SX! Have you tried something? I guess if you change (0,0) to something else it'll do what you want. – Phelype Oleinik Mar 19 at 19:37
  • That does not work as it would draw lines from (x,y) to points along a circle of radius \Radius centered at(0,0). The reply below, with the +, works exactly as I needed. Thanks – geguze Mar 19 at 19:57
  • 2
    I'm voting to close this question as off-topic because this is just a do-it-for-me question. Hence a -1. – Raaja Mar 20 at 6:05
  • @Raaja The OP is a new contributor, wait a bit before closing, please! – CarLaTeX Mar 20 at 6:31
4

Sure. Define a coordinate which should be the center point, state this first to all commands and then add a + before each coordinate. The plus sign makes the following coordinate relative to the one without a plus sign which then is exactly what you want. See Heiko's modified code to which I also added a red circle at (0,0) to prove that the center really is not there any more, but at the defined coordinate (A).

\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}

image showing the result of above code

  • It is probably simpler to use shifted scope, no ? – Kpym Mar 19 at 19:51
  • @Kpym, this would be another possibility. And I am pretty sure there are even more. Feel free to write an answer, too. This is what this site is all about, as you know ;) – Stefan Pinnow Mar 19 at 20:03
3

Here is another possibility : define a pic that you can place where you want after that. This is interesting only if you need to place the wheel multiple times.

\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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.