2

I'm trying to draw a trinity/trefoil knot with accompanying linking circles with the knots package, but I'm encountering a "paper circular-cutout" issue at intersections as demonstrated in the image below. (The faint circular "crop circle" artifacts are not the issue, being only visible on the .jpg conversion from .pdf.)

Decreasing the value of double distance reduces, but does not eliminate the issue.

A manual drawing of the linked ring using arcs outside of the knot environment is feasible, but the well-known issue with double's PDF rendering artifacts (manifesting here as lines at points where two doubles join) destroys the whole beauty of the thing: most viewers will see things electronically, not on paper.

Is there a workaround to this issue? I'm hoping for one that doesn't require a lot of manual intervention after adjusting the parameters in the code below: I intend to put math and text flowing along the various portions of the links and inside of the knot, the right parameters will need to be adjusted on the fly.

Trinity Paper-cutout

Minimal working example:

\documentclass[tikz]{standalone}%

\usetikzlibrary{knots}

\begin{document}

\begin{tikzpicture} % Ring Parameters \pgfmathsetmacro{\RingRadius}{3};

% Trefoil parameters
\pgfmathsetmacro{\TrefoilAngle}{120};
\pgfmathsetmacro{\InnRadius}{1};
\pgfmathsetmacro{\OutRadius}{4};

% Coordinates for trefoil bounding circle
\coordinate (bottom) at (270:\OutRadius);
\coordinate (left) at (150:\OutRadius);
\coordinate (right) at (30:\OutRadius);

% Coordinates for trefoil "hole"
\coordinate (innBot) at (270:\InnRadius);
\coordinate (innLeft) at (150:\InnRadius);
\coordinate (innRight) at (30:\InnRadius);

\begin{knot}[%
    % Use no splits to prevent: https://tex.stackexchange.com/q/708135
    consider self intersections = no splits,
    end tolerance=0.5pt,
    line width = 2,
    line join=round,
    clip width=1,
    ignore endpoint intersections=true,
    % draft mode = crossings,
    flip crossing/.list={2, 3, 8, 6},
    ]

    %%%%%%%%%%%%%
    %  Trefoil  %
    %%%%%%%%%%%%%
    \strand[%
        only when rendering/.style={%
        draw=teal,
        double=teal!20,
        double distance=9pt,
        },
    ]
    (innBot)
    to [out = 180, in = -30 - 0.5*\TrefoilAngle]
    (left)
    to [out = -30 + 0.5*\TrefoilAngle, in = 120]
    (innRight)
    to [out = -60, in = 90 - 0.5*\TrefoilAngle]
    (bottom)
    to [out = 90 + 0.5*\TrefoilAngle, in = -120]
    (innLeft)
    to [out = 60, in = -150 - 0.5*\TrefoilAngle]
    (right)
    to [in = 0, out = -150 + 0.5*\TrefoilAngle]
    (innBot)
    ;

    %%%%%%%%%%
    %  Ring  %
    %%%%%%%%%%
    \strand[
        only when rendering/.style={%
        draw=red,
        line width = 2pt,
        double=red!20,
        double distance=9pt,
        },
    ]
    (0, 0) circle [radius = \RingRadius];
\end{knot}

\end{tikzpicture}

\end{document}

  • Looks to me like you need to increase the size of the circles used to create the over/under effect. It's one of clip radius or clip width but I can never remember which! – Andrew Stacey Feb 13 '24 at 17:59
  • That was it! clip radius = 16pt does the job in this instance. If you add it as an answer I'll accept it. – cattywampus Feb 13 '24 at 18:15
  • 1
    Also, what a record time response! I've always wanted to thank you for all of the tikz libraries you've created and maintain. Really fantastic stuff that has saved me (and I'm sure many others) a ton of time. – cattywampus Feb 13 '24 at 18:16

1 Answers1

2

You need to set clip radius to something sensible. For testing, you can try: clip width=2, background color=yellow

\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{knots}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\RingRadius}{3}
\pgfmathsetmacro{\TrefoilAngle}{120}
\pgfmathsetmacro{\InnRadius}{1}
\pgfmathsetmacro{\OutRadius}{4}
\coordinate (bottom) at (270:\OutRadius);
\coordinate (left) at (150:\OutRadius);
\coordinate (right) at (30:\OutRadius);
\coordinate (innBot) at (270:\InnRadius);
\coordinate (innLeft) at (150:\InnRadius);
\coordinate (innRight) at (30:\InnRadius);
\begin{knot}[
consider self intersections=no splits,
end tolerance=0.5pt,
flip crossing/.list={1,2,5,6,8},
clip width=1,
clip radius=20pt,
]
\strand[
teal, double=teal!20,
line width=2pt, double distance=9pt,
] (innBot)
to [out=180, in=-30 - 0.5*\TrefoilAngle] (left)
to [out=-30 + 0.5*\TrefoilAngle, in=120] (innRight)
to [out=-60, in=90 - 0.5*\TrefoilAngle] (bottom)
to [out=90 + 0.5*\TrefoilAngle, in=-120] (innLeft)
to [out=60, in=-150 - 0.5*\TrefoilAngle] (right)
to [in=0, out=-150 + 0.5*\TrefoilAngle] (innBot);
\strand[
red, double=red!20,
line width=2pt, double distance=9pt,
] (0,0) circle [radius=\RingRadius];
\end{knot}
\end{tikzpicture}
\end{document}

Trefoil with interlaced ring

Do not use ; after pgfmathsetmacro. You do not need only when rendering.