2

I need to make an area of multiple segments, but with one surrounding border, like in the following picture. I tried many different ways, but all were unsatisfying---in this example the lines of the circle are cut off half, because of the overlaying "fill".

The only way it worked properly was by the use of intersections but this would take a few very annoying seconds everytime I process my document. While "even odd rule" allows to cut some parts out, I thought, maybe there's a way for merging, too.

Furthermore, the teeth should have a rounded outer border, too.

output

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

\def \rotor {
    (0, 0) circle (1)
    (0, 0) circle (2)
}

\startscope[even odd rule]
  \draw \rotor;
  \foreach \x in {1, ..., 6}
  {
    \draw[rotate=(\x-1)*60, fill=lightgray]
    (1, -0.3)   rectangle (3, 0.3);
  }
  \fill[lightgray] \rotor;
\stopscope

\end{tikzpicture}
\end{document}
4

Update: (2014/03/17) : Based on the comment by the OP, saying the first answer was not what was asking for. Feeling duty bounded, this second attempt tries to address the OP's concern again, which is the outer edges (of each tooth) should be arcs with center at (0,0) like the inner two circles, the first attempt was simply a rounded corner for each rectangle tooth.

Note: The blue and red lines for demonstration can be removed by replacing the \draw with \path in line 24 and 31.

enter image description here

Code:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,intersections,calc}

\begin{document}

\begin{tikzpicture}
\def \rotor {
   [name path=curve] (0, 0) circle (2)
   (0, 0) circle (1)
}

\startscope[even odd rule]
\foreach \x in {1, ..., 6}
  {
    \path[rotate=(\x-1)*60]  (0,0) -- ++ (-10:3)   
                             (0,0) -- ++ (10:3)  
                             (0,0) -- ++(-10:3) arc (-10:10:3);          % generate the arc section of a tooth
  }

\draw[fill=lightgray] \rotor;

\foreach \x in {1,...,6}
  { \draw[red,rotate=(\x-1)*60,name path=line \x]  (0,0) -- ++ (-20:3);  % Adjust this angle -10,-20, ... for all  kind of tooth
    \path[name intersections={of=curve and line \x, by={isect \x}}];
    \draw[rotate=(\x-1)*60,fill=lightgray]
    (isect \x) -- (-10:3) arc (-10:10:3) -- (20:2);                      % Adjust the last coordinate accordingly
  }

\foreach \x in {1,...,6}
  { \draw[blue,rotate=(\x-1)*60,name path=line \x]  (0,0) -- ++ (20:3);  % Adjust this angle 10, 20, ... for all  kind of tooth
    \path[name intersections={of=curve and line \x, by={isect \x}}];
    \draw[rotate=(\x-1)*60,fill=lightgray]
    (isect \x) --  (10:3) arc (10:-10:3) --(-20:2);                       % Adjust the last coordinate accordingly
  }
\stopscope
\end{tikzpicture}

\end{dcument}

Two appaoches are studied. The left one is done without using intersection package whilst the second one on the right is with help from intersection to find the insersecion of the tooth bases

enter image description here

Code

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,intersections,calc}

\begin{document}

% -- Do not use intersection package

\begin{tikzpicture}
\def \rotor {
    (0, 0) circle (1)
    (0, 0) circle (2)
}
\startscope[even odd rule]
\foreach \x in {1, ..., 6}
  {
    \draw[rotate=(\x-1)*60,rounded corners]
    (1.5, -0.3) rectangle (3, 0.3);
  }
\draw[fill=lightgray] \rotor;

\foreach \x in {1,...,6}
  { %\path[rotate=(\x-1)*60,name path=line \x] (1.5,-0.3) -- (3,-0.3);
    %\path[name intersections={of=curve and line \x, by={isect \x}}];
    \draw[rotate=(\x-1)*60,fill=lightgray,rounded corners]
    (1.97,-0.3) -- (3,-0.3) -- (3, 0.3) -- (1.97,0.3);   % knowing that it is cloe dotse to 2, so manually to determine 1.97, 
    %(isect \x) -- (3,-0.3) -- (3, 0.3) -- ($(isect \x)+(0,0.6)$);
  }
\stopscope
\end{tikzpicture}


% -- Use of insetection package

\begin{tikzpicture}
\def \rotor {
    (0, 0) circle (1)
   [name path=curve] (0, 0) circle (2)
}

\startscope[even odd rule]
\foreach \x in {1, ..., 6}
  {
    \draw[rotate=(\x-1)*60,rounded corners]
    (1.5, -0.3) rectangle (3, 0.3);
  }
\draw[fill=lightgray] \rotor;

\foreach \x in {1,...,6}
  { \path[rotate=(\x-1)*60,name path=line \x] (1.5,-0.3) -- (3,-0.3);
    \path[name intersections={of=curve and line \x, by={isect \x}}];
    \draw[rotate=(\x-1)*60,fill=lightgray,rounded corners]
    (isect \x) -- (3,-0.3) -- (3, 0.3) -- ($(isect \x)+(0,0.6)$);
  }
\stopscope
\end{tikzpicture}

\end{document}
  • That's not really what I'm searching for. If you make the border more bold, you'll see artifacts at the connections. I meant no rounded corners—the outer edges should be arcs with center at (0,0) like the inner two circles. If I get all four intersections of a rotor tooth with it's inner and outer circle I could easily draw the radial strokes, but my problem are the arc-sections. Therefore I need to draw an arc without knowing the angles but the starting and end point. I need to draw the circles section-wise or like in Alains answer in bit.ly/1iaDz3U. But I don't get this to work. – Zyklon Mar 15 '14 at 19:12
  • Hi, @Zyklon, Sorry for this late response. I have studied the web site you provided and, in my good faith, tried to help out with this new attempt, hoping it is helpful. Please see the update. – Jesse Mar 17 '14 at 4:03
  • Oh sorry, it was too long ago and I even cannot remember how I then (tried to) solve this. /o\ But still many thanks! – Zyklon Nov 4 '17 at 4:21

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.