After working out how generally to use Brandon Cole’s Shape Script code to display mathematical shapes in Tinkercad, I carried on looking for some interesting functions to “plot”. I ended up finding definitions for two Cinquefoil knots, specifically the (2,5) and the (5,2) variations (I also tried the (5,1), but that ended up looking just like the (5,2)). This “page that once was” helped a great deal with the underlying formulae, as of course did the online derivative calculator (Brandon tells me he personally used Wolfram Alpha to calculate his derivatives, a site I’ve blogged about in the past).
Here are the relevant lines of JavaScript for each of the knots…
Cinquefoil 2,5:
// Equation...
pt =
new XYZ(
Math.cos(2 * t) * (5 + 2 * Math.cos(5 * t)),
Math.sin(2 * t) * (5 + 2 * Math.cos(5 * t)),
2 * Math.sin(5 * t));
// Equation Derivative...
pt_d =
new XYZ(
-10 * Math.cos(2 * t) * Math.sin(5 * t) -
2 * Math.sin(2 * t) * (2 * Math.cos(5 * t) + 2),
2 * Math.cos(2 * t) * (2 * Math.cos(5 * t) + 5) -
10 * Math.sin(2 * t) * Math.sin(5 * t),
10 * Math.cos(5 * t));
Cinquefoil 5,1:
// Equation...
pt =
new XYZ(
(Math.cos(t) + 2) * Math.cos(5 * t),
(Math.cos(t) + 2) * Math.sin(5 * t),
-Math.sin(t));
// Equation Derivative...
pt_d =
new XYZ(
-5 * (Math.cos(t) + 2) * Math.sin(5 * t) -
Math.sin(t) * Math.cos(5 * t),
5 * (Math.cos(t) + 2) * Math.cos(5 * t) -
Math.sin(t) * Math.sin(5 * t),
-Math.cos(t));
Cinquefoil 5,2:
// Equation...
pt =
new XYZ(
(Math.cos(2 * t) + 2) * Math.cos(5 * t),
(Math.cos(2 * t) + 2) * Math.sin(5 * t),
-Math.sin(2 * t));
// Equation Derivative...
pt_d =
new XYZ(
-5 * (Math.cos(2 * t) + 2) * Math.sin(5 * t) -
2 * Math.sin(2 * t) * Math.cos(5 * t),
5 * (Math.cos(2 * t) + 2) * Math.cos(5 * t) -
2 * Math.sin(2 * t) * Math.sin(5 * t),
-2 * Math.cos(2 * t));
Here are the resulting objects inside the public model with the shared Shape Scripts: