5

I have tried to replicate a logo using tikz. As you can see the logo consists of seven triangles in a circle, with concave edges toward the center of the circle. To do this I have drawn the triangles and superimposed a white circle in the center. This works, but only if and when the background is white. I would love to make it transparent

I was hoping to use clip coupled with even odd rule to make this work, but that does not appear possible, so I am not sure how to do this in a simple, efficient way.

RFF logo

\definecolor{RFFgray}{HTML}{62615a}
\definecolor{RFFgreen}{HTML}{91b947}
\begin{tikzpicture}
    \foreach \i in {90,141.4,192.86,244.29,295.71,347.14}
    {
    \draw[fill,RFFgray] (\i:1)--++(122+\i:.5)--($(\i:1)+(\i-122:.5)$)--cycle;
    }    
    \draw[fill,RFFgreen] (38.57:1)--++(122+38.57:.5)--($(38.57:1)+(38.57-122:.5)$)--cycle;
    \draw[white,fill](0,0)circle(.87);
\end{tikzpicture}

3 Answers 3

7

You always can draw only the desired part: the 'triangles'. For example, with a \pic:

\documentclass[border=2mm,tikz]{standalone}
\usetikzlibrary{calc}
\tikzset
{%
  pics/my triangle/.style={%
    code={\path[pic actions] (0:1) -- (180/7:0.87) arc (180/7:-180/7:0.87) -- cycle;}
    }
}

\begin{document}
\definecolor{RFFgray} {HTML}{62615a}
\definecolor{RFFgreen}{HTML}{91b947}
\begin{tikzpicture}
  \foreach \i in {1,3,4,...,7}
    \pic[rotate=-360/7+360*\i/7,fill=RFFgray] {my triangle};
  \pic[rotate=360/7,fill=RFFgreen] {my triangle};
\end{tikzpicture}
\end{document}

enter image description here

Edit: As Anis suggests, here you can se the 'transparency'. Of course, there is nothing transparent here. Only what you can see is drawn.

\documentclass[border=2mm,tikz]{standalone}
\usetikzlibrary{calc}
\tikzset
{%
  pics/my triangle/.style={%
    code={\path[pic actions] (0:1) -- (180/7:0.87) arc (180/7:-180/7:0.87) -- cycle;}
    }
}

\begin{document}
\begin{tikzpicture}
  \node {\includegraphics[width=3.5cm]{example-image-duck}};
  \foreach \i in {1,3,4,...,7}
    \pic[rotate=-360/7+360*\i/7,fill=blue!50] {my triangle};
  \pic[rotate=360/7,fill=red!50] {my triangle};
\end{tikzpicture}
\end{document}

enter image description here

3
  • Suggestion to demonstrate the transparency: adding this line of code \begin{tikzpicture}[background rectangle/.style={draw=blue!50,fill=blue!20,rounded corners=1ex}, show background rectangle] from the tikz manual tikz.dev/library-backgrounds#tikz/background:rectangle
    – anis
    Commented Jan 6, 2023 at 9:08
  • @anis, thanks for the suggestion. Of course, you can draw anything behind as a demonstration, but I think it's not necessary, as there's nothing transparent. Only what you see is drawn. Commented Jan 6, 2023 at 9:22
  • 2
    Oh it is a ducky!!! <3
    – anis
    Commented Jan 6, 2023 at 9:32
4

enter image description here

It uses the TikZ command arc. There are two constants \cR and \cA that controls the dimensions of the triangles in case you need to modify them.

You can modify also the number of triangles.

enter image description here

The code

\documentclass[11pt, margin=.5cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{math}
\begin{document}

\definecolor{RFFgray}{HTML}{62615a}
\definecolor{RFFgreen}{HTML}{91b947}


\begin{tikzpicture}[evaluate={%
    integer \N; \N = 7;
    real \r, \cR, \d, \cD;
    \r = 1;
    \cR = .87;
    \cD = .33;
    \d = \cD*360/\N;
  }]
  \fill[violet!50] (-135: \r+.6) rectangle (45: \r+.6);
  \foreach \i [parse=true, evaluate=\i as \a using {(\i -1)*(360/\N) +90}]
  in {1, 2, ..., \N-1}{%
    \filldraw[RFFgray]
    (\a: \r) -- (\a -\d: \r*\cR) arc (\a -\d: \a +\d: \r*\cR) -- (\a: \r);
  }
  \filldraw[RFFgreen]
  (90 -360/\N: \r) -- (90 -360/\N -\d: \r*\cR)
  arc (90 -360/\N -\d: 90 -360/\N +\d: \r*\cR) -- (90 -360/\N: \r);

  \begin{scope}[xshift=2.5cm]
    \foreach \i [parse=true, evaluate=\i as \a using {(\i -1)*(360/\N) +90}]
    in {1, 2, ..., \N-1}{%
      \filldraw[RFFgray]
      (\a: \r) -- (\a -\d: \r*\cR) arc (\a -\d: \a +\d: \r*\cR) -- (\a: \r);
    }
    \filldraw[RFFgreen]
    (90 -360/\N: \r) -- (90 -360/\N -\d: \r*\cR)
    arc (90 -360/\N -\d: 90 -360/\N +\d: \r*\cR) -- (90 -360/\N: \r);
  \end{scope}
\end{tikzpicture}

\end{document}
1

You can use an inverted clip, e.g. from https://tex.stackexchange.com/a/138918/36296

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{calc}

%\pagecolor{red}

\tikzset{
    invclip/.style={
        clip, insert path={{(current page.north east) rectangle (current page.south west)}}},
}

\begin{document}

\definecolor{RFFgray}{HTML}{62615a}
\definecolor{RFFgreen}{HTML}{91b947}
\begin{tikzpicture}
    \begin{pgfinterruptboundingbox}
      \path[invclip] (0,0)circle(.87);
    \end{pgfinterruptboundingbox}
    \foreach \i in {90,141.4,192.86,244.29,295.71,347.14}
    {
    \draw[fill,RFFgray] (\i:1)--++(122+\i:.5)--($(\i:1)+(\i-122:.5)$)--cycle;
    }    
    \draw[fill,RFFgreen] (38.57:1)--++(122+38.57:.5)--($(38.57:1)+(38.57-122:.5)$)--cycle;
\end{tikzpicture}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .