Id like to add a command line option to control the total outer diameter of the trefoil created… but as math guru is not one of the hats I wear I’m at a loss where to inject the factor that fixes total outter diameter in that formula above… anyone care to take a punt?
gave that a go, using same factor, it does increase and decrease as expected, but I cant figure out the math so the user can input "I want a trefoil exactly 77.8mm diameter for example.
I took a poke at changing the “2” value in that formula… I waited about ten minutes and got a fantastic bowl of spaghetti back… (thinking of creating a spaghetti command actually)
I think the answer here will be to create a circle and flow this inside of it.
your major radius in the example above is 3. To create the knot with a desired major radius, divide the xyz point components with 3.0 then multiply with your desired value.
Ps. Your stepsize (0.1) is not very fine, so you will measure probably a major radius slightly below 3.0. btw. using a constant stepsize is not as good as dividing the range between 0 and 2 * Math.PI into equal steps. You see that near the curve seam if you turn on the curvature graph after closing the open curve.
The points of K will lie on a p,q torus knot, as long as you let t vary from 0 to 2piq. The trefoil is a 2,3 torus knot. The parameter R in the above is the distance form the origin to the center of the torus on which the knot sits. The parameter r is the width of the cross section of the torus, so that R+r will be the total diameter.