3

Here's my knot:

enter image description here

I started by drawing the red+blue strand, which went quite well with a Hobby curve.

\usepackage{tikz}
\usetikzlibrary{knots, hobby, shapes.geometric}

\begin{document}

\tikzset{
  knot diagram/every strand/.append style={
    ultra thick,
    red
  }}

\begin{tikzpicture}[use Hobby shortcut]
 \begin{knot}[scale=2,
   consider self intersections=true,%ignore endpoint
   % intersections=false,
   end tolerance=0.05mm,
  draft mode=crossings,
   flip crossing/.list={1,3},
   clip width=8,
   clip radius=8pt,
   only when rendering/.style={
   }
   ]
 \strand ([closed]2,0) .. (3, 0) .. (4, 2) .. (1.5, 0) .. (1.8, -0.4)
 .. (2.2, -0.4) .. (2.4, 0.4) .. (0, 2) .. (1, 0);

 \end{knot}
\end{tikzpicture}

\end{document}

Then I added in the green link as a circle:

\usepackage{tikz}
\usetikzlibrary{knots, hobby, shapes.geometric}

\begin{document}

\tikzset{
  knot diagram/every strand/.append style={
    ultra thick,
    red
  }}

\begin{tikzpicture}[use Hobby shortcut]
 \begin{knot}[scale=2,
   consider self intersections=true,%ignore endpoint
   % intersections=false,
   end tolerance=0.05mm,
  draft mode=crossings,
   flip crossing/.list={1,3},
   clip width=8,
   clip radius=8pt,
   only when rendering/.style={
   }
   ]
 \strand ([closed]2,0) .. (3, 0) .. (4, 2) .. (1.5, 0) .. (1.8, -0.4)
 .. (2.2, -0.4) .. (2.4, 0.4) .. (0, 2) .. (1, 0);
\strand[green] (2, -0.5) circle[radius=2cm];
 \end{knot}
\end{tikzpicture}
\end{document}

Now, I see: enter image description here

The crossing numbers have changed of course, but that's not a problem -- I can flip them. The problem is the crossing marked as '2': it's in the wrong place. If I try and flip it, the situation gets worse (zoom from image):

enter image description here

I eventually succeeded in drawing this knot by using a second Hobby curve for the green strand(*). I have drawn my knot -- I'm not looking for further advice on how to do this particular example. But I'm keen to get a better grasp on the knots library and I'd like to understand why the attempt using a circle behaves that way -- does anyone know? I tried making my circle bigger and smaller and shifting it a bit left and right, all to no avail... I don't know if there's something in the knots options that I was missing? Other than where the start point of a circle might lie, it's essentially symmetric with the crossing marked 7, which is handled correctly... so perhaps there's something to do with the circle starts?

(*) The working code, for completeness:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{knots, hobby, shapes.geometric}

\begin{document}

\tikzset{
  knot diagram/every strand/.append style={
    ultra thick,
    red
  }}

\begin{tikzpicture}[use Hobby shortcut]
 \begin{knot}[scale=2,
   consider self intersections=true,%ignore endpoint
   % intersections=false,
   end tolerance=0.05mm,
  draft mode=crossings,
   flip crossing/.list={1,4, 5,6 },
   clip width=8,
   clip radius=8pt,
   only when rendering/.style={
   }
   ]
 \strand ([closed]2,0) .. (3, 0) .. (4, 2) .. (1.5, 0) .. (1.8, -0.4)
 .. (2.2, -0.4) .. (2.4, 0.4) .. (0, 2) .. (1, 0);
\strand[green] ([closed]2, -1) .. (3.5, 0) .. (2, 1) .. (0.5, 0);

 \end{knot}
\end{tikzpicture}
\end{document}

1 Answer 1

1

This is not an answer, but is an explanation of the problem.

When consider self intersections is set to true then each path is split into segments so that the intersection routine can be used to find its self intersections. When doing so, it removes empty segments which consist of just movetos. It would appear that there is a bug when doing this with a circle, since a circle starts with a moveto from the centre to a point on the circumference. By removing the various clips, it is possible to see the path that the knots library is using to find the self intersections:

the circle with the moveto removed

So when the moveto is removed, it's the wrong moveto. This is a bug. I've opened an issue on github: https://github.com/loopspace/spath3/issues/29

5
  • thanks, that's really interesting! Especially as there are many existing knots using circles that don't run into this issue...
    – DrM
    Commented Jan 30 at 8:34
  • 1
    @MairAW It's the combination of circles with consider self intersections=true that triggers it, and I think that most uses of circles with knots are actually links so they don't look at self intersections. Commented Jan 30 at 18:25
  • @MairAW A smidgeon of progress: I think consider self intersections=no splits does not trigger the bug. Commented Jan 31 at 22:27
  • 1
    @MairAW I think I've fixed it, github.com/loopspace/spath3/commit/…, if you have the time to test then that would be great. Commented Jan 31 at 22:45
  • i downloaded spath3_code.dtx from the github there and ran pdflatex on it, hit enter to ignore it grumbling about checksum, reran my code above and indeed crossing 2 is now in the right place!
    – DrM
    Commented Feb 1 at 9:51

You must log in to answer this question.

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