12

I have been trying to trying to replicate this logo for my team (not to mention in LaTeX ofcourse:-)):

enter image description here

So where I am now:

\documentclass[11pt]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}% loads also tikz
\pgfplotsset{compat=newest}% to avoid the pgfplots warning
\usetikzlibrary{intersections, pgfplots.fillbetween}
%https://tex.stackexchange.com/questions/58702/creating-gears-in-tikz
% #1 number of teeths
% #2 radius intern
% #3 radius extern
% #4 angle from start to end of the first arc
% #5 angle to decale the second arc from the first 

\newcommand{\gear}[5]{%
    \foreach \i in {1,...,#1} {%
        [rotate=(\i-1)*360/#1]  (0:#2)  arc (0:#4:#2) {
            -- (#4+#5:#3)  arc (#4+#5:360/#1-#5:#3)} --  (360/#1:#2)
}}  
%https://tex.stackexchange.com/questions/48662/tikz-or-xcolor-lighten-color
\colorlet{MyColorOne}{blue!60}

\newcommand{\lightercolor}[3]{% Reference Color, Percentage, New Color Name
    \colorlet{#3}{#1!#2!white}
}

\newcommand{\darkercolor}[3]{% Reference Color, Percentage, New Color Name
    \colorlet{#3}{#1!#2!black}
}


\lightercolor{MyColorOne}{50}{MyColorOneLight}
\darkercolor{MyColorOne}{50}{MyColorOneDark}
%https://tex.stackexchange.com/questions/255234/how-does-one-pick-control-points-to-control-b%C3%A9zier-curves-in-tikz
\newcommand\DrawControl[3]{
    node[#2,circle,fill=#2,inner sep=2pt,label={above:$#1$},label={[black]below:{\footnotesize#3}}] at #1 {}
}
%https://tex.stackexchange.com/questions/66490/drawing-a-tikz-arc-specifying-the-center/218814
\tikzset{
    pics/carc/.style args={#1:#2:#3}{
        code={
            \draw[pic actions] (#1:#3) arc(#1:#2:#3);
        }
    }
}
\begin{document}
    \begin{tikzpicture}
    %\draw[help lines, step=.1] (-3,-3) grid (3,3);
    \draw[help lines] (-3,-3) grid (3,3);
    \draw[name path = a,thick] \gear{9}{2}{2.8}{15}{6};
    \draw[name path = b, black,fill=black] (0,0) circle (1.65cm);
    \draw[name path = c, white] (0,0) circle (1.7cm);
    \tikzfillbetween[of=a and c]{MyColorOneDark};
    \tikzfillbetween[of=b and c]{white};
    \draw[black,fill=black] (0,0) circle (1.65cm);
    \draw[white] (0,0) circle (1.7cm);
    \draw[ultra thick,white] 
    (1,-1.34) 
    .. controls (1,-0.65) and (-1.4,0.4) .. 
    %to
    (-1,-0.6);
    \draw[ultra thick,white] 
    (-1,-0.6) 
    .. controls (-1.3,0.3) .. 
    (0.75,0.75);% \DrawControl{(4,2)}{blue}{}; %\DrawControl{(3,2)}{blue}{1}\DrawControl{(5,2)}{blue}{2};   
    \draw[ultra thick,white] 
    (0,0.58) 
    .. controls (0.3,1) .. 
    (1.3,1.05);
    \draw[ultra thick, white] (0.535,0.66) pic{carc=20:-150:0.2};
    \end{tikzpicture}  
\end{document}

which gives me:

enter image description here

Having said that, with respect to the original figure, the challenges that I face are three-fold:

1. I am not able to match the blue color between the gears and the first white circle. [worked as per Phelype Oleinik suggestion]

  1. I am not able to replicate the barrel shape in the teeth region of my figure (compared to original).

  2. Finally, ofcourse, I used a lot of helps from other answers that are linked to this question (especially, @Gonzalo's Bézier trick). But still I am not able to get the smooth finishing of my Falcon.

All helps and suggestions are appreciated. Nevertheless, any optimisations of my code is more than welcome.

1 Answers1

14

I was always scared by falcons. They hunt us! (With to[in=...,out=...] one can do a lot of things, and if one in and the next out differ by 180, there is no kink.)

\documentclass[11pt]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}% loads also tikz
\pgfplotsset{compat=newest}% to avoid the pgfplots warning
\usetikzlibrary{intersections, pgfplots.fillbetween}
%https://tex.stackexchange.com/questions/58702/creating-gears-in-tikz
% #1 number of teeths
% #2 radius intern
% #3 radius extern
% #4 angle from start to end of the first arc
% #5 angle to decale the second arc from the first 

% Max' comment
\newcommand{\gear}[5]{ \foreach \i in {1,...,#1} { [rotate=(\i-1)*360/#1] (0:#2) arc (0:#4:#2) .. controls (#4:1.1*#2) and (#4+#5/2:0.95*#3) .. (#4+#5:#3) arc (#4+#5:360/#1-#5:#3) .. controls (360/#1-#5/2:0.95*#3) and (360/#1:1.1*#2) .. (360/#1:#2) }}

\colorlet{MyColorOne}{blue!60}

\newcommand{\lightercolor}[3]{% Reference Color, Percentage, New Color Name
    \colorlet{#3}{#1!#2!white}
}

\newcommand{\darkercolor}[3]{% Reference Color, Percentage, New Color Name
    \colorlet{#3}{#1!#2!black}
}


\lightercolor{MyColorOne}{50}{MyColorOneLight}
\darkercolor{MyColorOne}{50}{MyColorOneDark}
%https://tex.stackexchange.com/questions/255234/how-does-one-pick-control-points-to-control-b%C3%A9zier-curves-in-tikz
\newcommand\DrawControl[3]{
    node[#2,circle,fill=#2,inner sep=2pt,label={above:$#1$},label={[black]below:{\footnotesize#3}}] at #1 {}
}
%https://tex.stackexchange.com/questions/66490/drawing-a-tikz-arc-specifying-the-center/218814
\tikzset{
    pics/carc/.style args={#1:#2:#3}{
        code={
            \draw[pic actions] (#1:#3) arc(#1:#2:#3);
        }
    }
}
\begin{document}
    \begin{tikzpicture}
    %\draw[help lines, step=.1] (-3,-3) grid (3,3);
    \draw[help lines] (-3,-3) grid (3,3);
    \draw[name path = a,thick] \gear{10}{2}{2.8}{15}{6};
    \draw[name path = b, black,fill=black] (0,0) circle (1.65cm);
    \draw[name path = c, white] (0,0) circle (1.7cm);
    \tikzfillbetween[of=a and c]{MyColorOneDark};
    \tikzfillbetween[of=b and c]{white};
    \draw[black,fill=black] (0,0) circle (1.65cm);
    \draw[white] (0,0) circle (1.7cm);
    \draw[ultra thick,white,line join=bevel] 
        (-52:1.67) to[out=100,in=-10]  (0,-0.5)
        to[out=170,in=20] (-0.7,-0.55)
        to[out=200,in=80,looseness=0.8] (-0.8,-0.85)
        to[out=120,in=-160,looseness=1.2] (-0.2,0.5)
        to[out=20,in=-170,looseness=1.2] (0.75,0.7)
        to[out=-70,in=-60,looseness=1.3] (0.3,0.4);
    \draw[ultra thick,white] 
    (-0.2,0.5) to[out=45,in=180] (0.5,1) to[out=0,in=170] (32:1.68);
    \end{tikzpicture}  
\end{document}

enter image description here

UPDATE: Implemented Max' suggestions for the teeth of the gear and also changed the teeth of the falcon. (Those who want to object that falcons do not have teeth: here's a counter example. ;-)

Addendum: Original beak and removed things that are not used.

\documentclass[11pt]{standalone}
\usepackage{pgfplots}% loads also tikz
\pgfplotsset{compat=newest}% to avoid the pgfplots warning
\usetikzlibrary{pgfplots.fillbetween}
%https://tex.stackexchange.com/questions/58702/creating-gears-in-tikz
% #1 number of teeths
% #2 radius intern
% #3 radius extern
% #4 angle from start to end of the first arc
% #5 angle to decale the second arc from the first 

% Max' comment
\newcommand{\gear}[5]{ \foreach \i in {1,...,#1} { [rotate=(\i-1)*360/#1] (0:#2) arc (0:#4:#2) .. controls (#4:1.1*#2) and (#4+#5/2:0.95*#3) .. (#4+#5:#3) arc (#4+#5:360/#1-#5:#3) .. controls (360/#1-#5/2:0.95*#3) and (360/#1:1.1*#2) .. (360/#1:#2) }}

\colorlet{MyColorOne}{blue!60}

\newcommand{\lightercolor}[3]{% Reference Color, Percentage, New Color Name
    \colorlet{#3}{#1!#2!white}
}

\newcommand{\darkercolor}[3]{% Reference Color, Percentage, New Color Name
    \colorlet{#3}{#1!#2!black}
}


%\lightercolor{MyColorOne}{50}{MyColorOneLight}
\darkercolor{MyColorOne}{50}{MyColorOneDark}
%https://tex.stackexchange.com/questions/255234/how-does-one-pick-control-points-to-control-b%C3%A9zier-curves-in-tikz
\begin{document}
    \begin{tikzpicture}
    %\draw[help lines, step=.1] (-3,-3) grid (3,3);
    \draw[help lines] (-3,-3) grid (3,3);
    \draw[name path = a,thick] \gear{10}{2}{2.8}{15}{6};
    \draw[name path = b, black,fill=black] (0,0) circle (1.65cm);
    \draw[name path = c, white] (0,0) circle (1.7cm);
    \tikzfillbetween[of=a and c]{MyColorOneDark};
    \tikzfillbetween[of=b and c]{white};
    \draw[black,fill=black] (0,0) circle (1.65cm);
    \draw[white] (0,0) circle (1.7cm);
    \draw[ultra thick,white] 
        (-52:1.7) to[out=100,in=-10]  (0,-0.5)
        to[out=170,in=10] (-0.7,-0.55)
        to[out=170,in=80] (-0.8,-0.85)
        to[out=120,in=-160,looseness=1.2] (-0.2,0.5)
        to[out=20,in=-170,looseness=1.2] (0.75,0.7)
        to[out=-70,in=-60,looseness=1.3] (0.3,0.4);
%     \draw[ultra thick,white,line join=bevel] 
%         (-52:1.67) to[out=100,in=-10]  (0,-0.5)
%         to[out=170,in=20] (-0.7,-0.55)
%         to[out=200,in=80,looseness=0.8] (-0.8,-0.85)
%         to[out=120,in=-160,looseness=1.2] (-0.2,0.5)
%         to[out=20,in=-170,looseness=1.2] (0.75,0.7)
%         to[out=-70,in=-60,looseness=1.3] (0.3,0.4);
    \draw[ultra thick,white] 
    (-0.2,0.5) to[out=45,in=180] (0.5,1) to[out=0,in=170] (32:1.68);
    \end{tikzpicture}  
\end{document}

enter image description here

  • 3
    You could add some string around the bill so the falcon can not hunt marmots – samcarter_is_at_topanswers.xyz Jan 09 '19 at 15:11
  • 1
    Definitely, my falcon will hunt @marmot. Nevertheless, +1 For my tikizifying my Falcon!! I wish I could give more. Could you also suggest how to make teeth barrel shaped? – Raaja_is_at_topanswers.xyz Jan 09 '19 at 15:12
  • 3
    @Raaja Try \newcommand{\gear}[5]{ \foreach \i in {1,...,#1} { [rotate=(\i-1)*360/#1] (0:#2) arc (0:#4:#2) to[out=#4+#5,in=#4+#5-150,looseness=0.7] (#4+#5:#3) arc (#4+#5:360/#1-#5:#3) to[out=#4+#5+150,in=#4+#5,looseness=0.7] (360/#1:#2) }} for an approximation of the barrel shape. – Max Jan 09 '19 at 15:26
  • 2
    @Max Nice to see you again! (You know what, I was messing with the falcon teeth in my update. Arghhhhh! ;-) –  Jan 09 '19 at 15:29
  • 1
    @Max nice to see you! Top finish!! – Raaja_is_at_topanswers.xyz Jan 09 '19 at 15:37
  • @marmot super answer at last;) – Raaja_is_at_topanswers.xyz Jan 09 '19 at 15:38
  • 1
    @Raaja Thanks! marmot Also thanks and great answer! – Max Jan 09 '19 at 15:40
  • 1
    @marmot I noticed a slight difference in the two sides of the teeth, so a better solution would probably be: \newcommand{\gear}[5]{ \foreach \i in {1,...,#1} { [rotate=(\i-1)*360/#1] (0:#2) arc (0:#4:#2) .. controls (#4:1.1*#2) and (#4+#5/2:0.95*#3) .. (#4+#5:#3) arc (#4+#5:360/#1-#5:#3) .. controls (360/#1-#5/2:0.95*#3) and (360/#1:1.1*#2) .. (360/#1:#2) }} – Max Jan 09 '19 at 15:55
  • @marmot I'm gonna use the beak for my falcon from your first version ;) – Raaja_is_at_topanswers.xyz Jan 09 '19 at 16:26
  • 1
    @Raaja OK, I added this version (in which I also kicked out things that are not used). In principle, you do not need fillbetween for that, but this example illustrates how powerful this stuff is. –  Jan 09 '19 at 16:34
  • 1
    @marmot ain't you a bit too heavy for a falcon? – sztruks Jan 09 '19 at 18:57
  • 3
    For the record, the shape of gear teeth has a pretty precise mathematical definition, to ensure they grip correctly. See involute gearing on Wikipedia. The parametric representation of the involute of a circle is X (t) = r (cos t + (ta) sin t), Y (t) = r (sin t − (ta) cos t). Two of those curves facing each other, with a “cap,” would produce a perfect gear tooth. – KRyan Jan 09 '19 at 19:16
  • 1
    @sztruks The fact that they hunt us does not mean that they get us. But yes, in a world in which eagles hunt sheep, unfortunately falcons try also to catch marmots. –  Jan 09 '19 at 19:21