Thursday, January 23, 2014

Day 150 - Trefoil torus knots

For the next four days we'll be posting various mathematically interesting models of the trefoil knot. Mathematicians consider two knotted forms to be equivalent if one can be transformed into the other by stretching and moving in space, without cutting or joining. The way a knot sits in space is known as its conformation. Two of the best-known shapes for the trefoil knot are the T(2,3) and T(3,2) torus knot conformations:


STL file for T(2,3): http://www.geekhaus.com/makerhome/day150_trefoil_torus23_40_25_3.stl
STL file for T(3,2): http://www.geekhaus.com/makerhome/day150_trefoil_torus32_40_25_3.stl
Thingiverse link: http://www.thingiverse.com/thing:234107

Settings: MakerWare .3mm/low in 20-25 minutes per knot, with the custom slicing profile from Day 110.

Technical notes, math flavor: Torus knots are knots that can be wrapped around a torus (inner-tube or donut shape) without any self-intersections. The torus knot T(p,q) wraps p times around the torus like a clock at the same time that it wraps q times around the handle of the torus. The knot T(p,q) is always equivalent to the knot T(q,p), even though the two conformations can at first glance appear to be quite different. In the picture below from Paul Aspinwall at Duke University, the torus knot T(3,5)=T(5,3) wraps 3 times around the outside and 5 times around the handle.


The parametric equations for a torus with handle radius a and large radius c are (see Wolfram):
x = (c + a cos v) cos u
y = (c + a cos v) sin u
z = a sin v
If we substitute u=pt and v=qt then as t runs from 0 to 2휋 we obtain a curve that traces the T(p,q) torus knot around the surface of the torus (and if p and q are reversed then we get the T(q,p) torus knot).

Technical notes, OpenSCAD flavor: The knots are made using parametric equations that trace out a curve along the surface of a torus. The code below samples points along this curve, puts spheres at those points, and then connects adjacent points with a hull.  You can control the thickness of the curve by changing the radius of the spheres. Much thanks to kitwallace who had the idea to model curves this way in OpenSCAD.  Making knot models that can export to STL files is easy to do in Mathematica (see Day 110),  but Mathematica is not a free tool and not everyone has access to it. In addition, Mathematica does not always export reliable STL files. OpenSCAD is free and makes fairly stable STL files; the only penalty is that it is SLOW. Here is the commented OpenSCAD code that produced the two models in this post:

// mathgrrl parametric knots - torus trefoils
// tubify module based on tube module from kitwallace
// http://www.thingiverse.com/thing:230557/
// remove comments for the one you want to compile

/* 
// trefoil as the torus knot T(2,3)
// http://mathworld.wolfram.com/Torus.html
// take parameterization of torus (u,v)->R^3
// and let u=2t, v=3t
// scaled to 40mm before tubifying
function f(t) = 
[ 3.9*(3+1.6*cos(2*t))*cos(3*t), 
 3.9*(3+1.6*cos(2*t))*sin(3*t),
 3.9*(1.6*sin(2*t)) 
];
// create the knot with given radius and step
tubify(2.5, 12, 360);
*/

/*
// trefoil as the torus knot T(3,2)
// http://mathworld.wolfram.com/Torus.html
// take parameterization of torus (u,v)->R^3
// and let u=2t, v=3t
// scaled to 40mm before tubifying
function f(t) = 
[ 3.9*(3+1.6*cos(3*t))*cos(2*t),  
 3.9*(3+1.6*cos(3*t))*sin(2*t),
 3.9*(1.6*sin(3*t)) 
];
// create the knot with given radius and step
tubify(2.5, 3, 360);
*/

module tubify(r, step, end) {
for (t=[0: step: end+step]) {
hull() {
translate(f(t)) sphere(r);
translate(f(t+step)) sphere(r);
       }
   }
};

3 comments:

  1. nice Torii ! must be so nice to have your own printer ( he says whistfully)

    I put a Torus customizer on Thingiverse http://www.thingiverse.com/thing:231727 - it only supports the t(u,v) parameters but it does include other shape parameters

    re tubify, replacing cones with hulled cones is certainly faster than hulled spheres (but they need orientating) - the mailing list has got stuck into this problem and developments afoot look very promising, albeit that they dont deal with self-intersecting curves

    BTW theT(2,3) STL link fails

    ReplyDelete
  2. okay, i think the file is uploaded correctly now, sorry about that! i tried to write a cylinders-oriented-by-directional-derivative type of thing but it was so. very. slow. and i couldn't get it to work out. and in the corners i would have had to add spheres anyway. i'm definitely interested in anything people are working on in this capacity. what kind of mailing list are you on and is it private or could i possibly join it?

    ReplyDelete
  3. The rollingknot code with cones is now on github https://github.com/KitWallace/openscad/blob/master/rollingknot.scad - it seemed to me more than twice as fast as spheres.

    The github mailing list is http://forum.openscad.org/ - this is where the real openscad gurus hang out

    ReplyDelete