5

I wish to draw something like this

    \begin{tikzpicture}[line width=3pt, color=blue!55!black!74, rotate=-0]
    \def\g{360/6}
    \def\r{2.7}
    \coordinate(A1) at(\g:\r);
    \coordinate(A2) at(2*\g:\r);
    \coordinate(A3) at(3*\g:\r);
    \coordinate(A4) at(4*\g:\r);
    \coordinate(A5) at(5*\g:\r);
    \coordinate(A6) at(6*\g:\r);

\draw(A1) node[rotate=-30] {\scalebox{13}{$\infty$}};

\draw(A2) node[rotate=30] {\scalebox{13}{$\infty$}};
\draw(A3) node[rotate=90] {\scalebox{13}{$\infty$}};
\draw(A4) node[rotate=150] {\scalebox{13}{$\infty$}};
\draw(A5) node[rotate=210] {\scalebox{13}{$\infty$}};
\draw(A6) node[rotate=270] {\scalebox{13}{$\infty$}};

\end{tikzpicture}

with some more modification of the infinity symbol into this (still 6 symbol) but the curve is uniform in width, and there should be some signs of true intersections as in the photo attached.

enter image description here

Epa
  • 3,449
  • Have you looked at the knot and spath3 tikz libraries? They contain methods to illustrate intersections in this fashion. – Andrew Stacey Jul 14 '21 at 06:01
  • I had a look at celtic knot tikz documentation written by you but was unable to handle. The spath3 is just too technical for me. – Epa Jul 14 '21 at 07:24
  • The celtic package isn't right for this as that works for diagrams laid out on a grid. For this then the original knots package would be the most suitable. – Andrew Stacey Jul 14 '21 at 13:09

2 Answers2

4

Here is an approximation with clips. I made a pic for the infinity symbol that I'm drawing in two parts (top and bottom). Then, the most important thing in my approach is playing with the needed clips. They are the key for fixing each infinity symbol over or under the others.

\documentclass[border=2mm]{standalone}
\usepackage    {tikz}

% dimensions \def\R {2} % outer radius \def\r {1} % inner radius \def\sp{13} % centers separation \pgfmathsetmacro\a{acos((0.5\R+0.5\r)/\R)} % intersection angle (between circles)

% styles \definecolor{color1}{rgb}{0 ,0.4,0 } % green \definecolor{color2}{rgb}{0 ,0 ,0.4} % blue \definecolor{color3}{rgb}{1 ,0.4,0 } % orange \definecolor{color4}{rgb}{1 ,1 ,0 } % yellow \definecolor{color5}{rgb}{0.7,0 ,0 } % red \definecolor{color6}{rgb}{0.4,0 ,0.4} % magenta \tikzset {% pics/infinity/.style={% code={% \foreach\i in {-1,1} {% fill \begin{scope}[x={(\i cm,0 cm)}, y={(0 cm,\i cm)}] \fill (0.5\R+1.5\r,0) arc (360:180:\r) arc (0:180:0.5\R-0.5\r) arc (360:180:\r) arc (0:180:0.5\R-0.5\r) arc (180:360-\a:\R) arc (180+\a:360:\R) -- cycle; \end{scope} } \foreach\i in {-1,1} {% draw \begin{scope}[x={(\i cm,0 cm)}, y={(0 cm,\i cm)}] \draw (-0.5\R+0.5\r,0) arc (-180:180-\a:\R); \draw (\R-0.5*\r,0) circle (\r); \end{scope} } }}, }

\begin{document} \begin{tikzpicture}[line cap=round,line join=round,line width=0.75mm] \def\HA{4.3} % 'hexagon' apotheme \def\PA{3.5} % 'pentagon' apotheme \useasboundingbox (-1.55\HA,-1.55\HA) rectangle (\sp+1.7\PA,1.55\HA); \begin{scope} % hexagon \foreach\i in {1,...,6} \draw (60\i-30:\HA) pic[rotate=60\i+60,draw=gray!15,fill=color\i]{infinity}; \begin{scope} \clip (0,0) -- (30:2\HA) -- (-30:2\HA) -- cycle; \draw (60-30:\HA) pic[rotate=60+60,draw=gray!15,fill=color1]{infinity}; \end{scope} \clip (0,0) circle (\HA); \foreach\i in {5,...,1} \draw (60\i-30:\HA) pic[rotate=60\i+60,draw=gray!15,fill=color\i]{infinity}; \begin{scope} \clip (0,0) -- (30:2\HA) -- (-30:2\HA) -- cycle; \draw (606-30:\HA) pic[rotate=606+60,draw=gray!15,fill=color6]{infinity}; \end{scope} \end{scope} % \begin{scope}[shift={(\sp,0)}] % pentagon \foreach\i in {1,...,5} \draw (72\i-18:\PA) pic[rotate=72\i-108,draw=gray!15,fill=color\i]{infinity}; \begin{scope} \clip (0,0) -- (69:2.5\PA) -- (-3:2.5\PA) -- cycle; \draw (72-18:\PA) pic[rotate=72-108,draw=gray!15,fill=color1]{infinity}; \end{scope} \clip (0,0) circle (\PA); \foreach\i in {5,...,1} \draw (72\i-18:\PA) pic[rotate=72\i-108,draw=gray!15,fill=color\i]{infinity}; \begin{scope} \clip (0,0) -- (69:2.5\PA) -- (-3:2.5\PA) -- cycle; \draw (725-18:\PA) pic[rotate=725-108,draw=gray!15,fill=color5]{infinity}; \end{scope} \end{scope} \end{tikzpicture} \end{document}

enter image description here

Edit: Added the 'hexagon'.

Juan Castaño
  • 28,426
4

Here's a rendering of your diagram using the knots package. This package calculates the intersections of the various pieces of the diagram and redraws the strands in a neighbourhood of each intersection to get the over-path effect. To that extent, it is doing a similar thing to Juan's manually-calculated code. What it does in addition is that when re-rendering the over-paths it does the two parts (edge and middle) carefully to ensure that there are no artifices in the resulting image (these are more evident in problem with "crop circles" in tikz knot library but can also be seen very, very faintly in Juan's answer).

\documentclass{article}
%\url{https://tex.stackexchange.com/q/604921/86}
\usepackage{tikz}
% Load the necessary libraries
\usetikzlibrary{knots,spath3,hobby}

% Save the colours in useful aliases to be able to refer to them by number \colorlet{link0}{red} \colorlet{link1}{yellow} \colorlet{link2}{green} \colorlet{link3}{cyan} \colorlet{link4}{blue} \colorlet{link5}{magenta}

% Strands can't be put inside a foreach loop (local/global stuff) % so this style is a convenient shortcut to make it easy to define % multiple copies of the symbol. % % strand colour makes it possible to reuse the colour in a variety % of ways \tikzset{ infinity path/.style 2 args={ spath/use={infinity, transform={rotate=180+#1*360/#2,yshift=2.8cm}}, strand colour=link#1 }, strand colour/.initial=black, }

\begin{document}

% Define and store the basic symbol path \begin{tikzpicture}[overlay] \path[use Hobby shortcut,spath/save global=infinity] ([closed]-1.5,1) .. (1.5,-1) .. (1.5,1) .. (-1.5,-1); \end{tikzpicture}

\begin{tikzpicture} % Draw the strands in gray to create the shadow effect \foreach \k in {0,...,4} { \draw[ line width=20pt, gray!25, infinity path={\k}{5}, ]; } \begin{knot}[ consider self intersections=no splits,% end tolerance=1pt,% % this ends up being the line width of the outer white edges line width=2pt, % the "wipeout" path shouldn't be thicker than the original path clip width=1,% % the paths are quite thick so we need a wide clip radius clip radius=20pt, % the intersections aren't near the ends of the paths ignore endpoint intersections=true,% % this turns into the edge colour background colour=white,% % the list of crossings to flip flip crossing/.list={2,5,8,11,14}, % when rendering an intersection, apply this style every intersection/.style={ % set to the full width of the path, this is used when the % wipeout path is drawn line width=13pt, only when rendering/.style={ % these are used when redrawing the over-path, only the % central part of the path is drawn here; % set the colour to the strand colour draw=\pgfkeysvalueof{/tikz/strand colour}, % this is the width of the inner part line width=9pt, % disable the double feature double=none, } }, % when drawing the symbol originally, we use this style only when rendering/.style={ % outer colour white, % width of the outer edge line width=2pt, % width of the inner path double distance=9pt, % colour of the inner path double=\pgfkeysvalueof{/tikz/strand colour}, }, ] \strand[infinity path={0}{5}]; \strand[infinity path={1}{5}]; \strand[infinity path={2}{5}]; \strand[infinity path={3}{5}]; \strand[infinity path={4}{5}]; \end{knot} \end{tikzpicture}

\end{document}

Infinity symbols in a pentagon

Changing the 5s to 6s, the radius from 2.8 to 3.3, and adding an extra strand, results in the hexagonal version.

Hexagonal symbols

Andrew Stacey
  • 153,724
  • 43
  • 389
  • 751