Drawing knots

A problem came to my desk from the hands of Dani (a nice source of problems, btw): drawing knots on a computer! I messed around the web and found a couple of pstricks… but they were not general enough, so I made up my mind to try my own generator. This way xknots was born.

Xknots reads a file in a certain format and renders a postscript file for a 2D view of the knot. What is a 2D view of the knot? OK, here you have one, which goes by the name of trefoil knot:

First of all, mathematical knots are closed curves on R^3. So, no dangling ends. A 2D view is just flattening the knot, and marking at each crossing which thread is above which. My idea was to invent a description rule for each knot. First, we state the number of crossings. So, 3 in our case. In order to understand a crossing, let us look at the next picture:

There are two types of crossings: L and R. All of them have four legs, numbered 1 to 4. So, in order to describe the knot, we give the coordinates of the crossings, along with their type. For example:

(200,100) L

That’s a nice crossing description. We can also, if needed, specify the angles:

(200,100) L A 60 90

The “A 60 90” means that the first leg will point at 60 degrees (counterclockwise) from the X axis, and the angle between the 1 and 2 legs is 90 degrees. Once the crossings are done, we join them with lines, for example:

1-2 3-4

This means: join the 2nd leg of the 1st crossing to the 4th leg of the 3rd crossing. If needed, we can specify how “extended” that line should be. This way,

1-2 3-4 F 2

means that this line wants to go very far away from the shortest path (the default is F 1). The full code for the trefoil is:

(120,120) L A 60 120
(180,120) L A 0 120
(150,172) R A 60 60
1-1 3-3
1-2 3-2 F 2
1-3 2-4 F 2
1-4 2-3
2-1 3-1 F 2
2-2 3-4

(all calculated to make a nice equilateral triangle). Here you have a couple of knots more:

The first is the “borromean rings”, the second goes by the funny name of 7_4… So, you can find the source code (C++ for linux, but pretty standard), more ideas and more explanations at the main webpage of the project…

And thanks to Dani & Alberto!


4 thoughts on “Drawing knots

  1. Great! and very good work, Javi … but not all knots are so nice, I guess xknots would have some troubles for drawing the so called “wild knots”
    ;-) … for more information, google!! …

  2. Thank you!! :) And yes, you’re right… but we can always make some changes. For example, make variable linewidths and some simple looping capabilities. This way, we’d be able to make wild knots.

  3. Can you do knot manipulations also? And, can your program compute the optimum visualization? I mean, not giving them angles and such…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s