sizeA trefoil knot can be described by these parametric equations:
x(t) = sin(t) + 2sin(2t)
y(t) = cos(t) - 2cos(2t)
z(t) = -sin(3t)
Each equation is represented by a module. Given an input value of t, they return values for x, y, and z.
These x,y,z values are used to translate a "point", which here is a cube. Hulling the loop connects the points.
To make the rainbow color, each cube is given a different hue in the chain hull loop. Since the hue can run between 0 and 100, and the loop runs between 0 and 360, i is divided by (360 / 100) = 3.6. You can get the rainbow loop twice through if you divide by 1.8.10xADDSINtMULTIPLY2SINMULTIPLY2tyMINUSCOStMULTIPLY2COSMULTIPLY2tzNEGSINMULTIPLY3tsizesizesizeiTRUE036515iiiHSVDIVIDEi3.6100100true0.60.60.6