What I'm after might be thought of as operating on the 'rope' that KnotData[] uses. Specifically, I'd like to be able to specify that the knot is to be made of a prism (not the Mathematica Prism[], which is always triangular) whose cross section could be a not-necessarily-regular $n$-gon, and could be twisted a la the Möbius strip. Looking at the daunting appearance of the InputForm[] of KnotData[] convinces me that polygonalization and twisting steps should precede KnotData[] - but how?

Here is the InputForm[] structure for several knots (e.g., Torus, Trefoil)

Graphics3D[{{GraphicsComplex[{{-0.53993, -0.00924, 0.16395}, ... ,
                           {-0.50971, 0.00165, 0.07456}}, 
    GraphicsGroup[{Polygon[{{1, 2, 14, 13}, ... , 
                             {8820, 8809, 8821, 8832}}]}]}, {}}}, 
VertexNormals -> {{0.00026, -0.18488, 0.98276}, ...,
                  {0.60404, 0.15619, -0.78149}}]}}, 
{Boxed -> False, PlotRange -> {All, All, All}, PlotRangePadding -> 
{Automatic, Automatic, Automatic}, ViewPoint -> {0, 0.01, 5}}]

Notes: Tube seems to be the default (whether explicitly specified, or not, as in the above). Documentation, i.e., ref/KnotData, shows the use of Sphere to accomplish a similar goal. And, speaking of docs, there seems to be an omission: Below list of Classes omits "Ribbon", "Slice", and "Twist" though all three are included in the "Basic classes of knots" in ref/KnotData. Both "Alternating" and "Nonalternating" are listed as "Basics", though it appears that "Nonalternating" should be with the other Non's in "Negative classes of knots."


{"Alternating", "Amphichiral", "Chiral", "Composite", "Hyperbolic",
"Invertible", "Nonalternating", "Nonhyperbolic", "Noninvertible",
"Nonsatellite", "Nontorus", "Prime", "Satellite", "Torus"}

Lastly, I obviously haven't gotten the hang of Markdown yet. Much obliged.


1 Answer 1


What follows is basically @TeakeNutma's answer to Extruding along a path, but modified to allow arbitrary n-gons as the cross section. First, here is one way to obtain a parametrized n-gon. Suppose the points making up the 2D n-gon are given in a list pts. For example:

pts = {{1, 0}, {-1/2, 1}, {-1/2, -1}};

Then, you can parametrize the n-gon by creating a 3D InterpolatingFunction:

poly = Interpolation[
        Range[0, Length[pts]],
        PadRight[pts, {Length[pts]+1, 3}, PadRight[pts[[1]], 3]]

Let's check out the 2D projection of this InterpolatingFunction:

ParametricPlot[poly[t][[;;2]], {t, 0, Length[pts]}]

enter image description here

The space curve for a knot can be obtained using the "SpaceCurve" property:

knot = KnotData["Trefoil", "SpaceCurve"]

{Sin[#1] + 2 Sin[2 #1], Cos[#1] - 2 Cos[2 #1], -Sin[3 #1]} &

Now, we use poly and knot to create your graphic:

    knot[u] + 1/8 RotationMatrix[{{0,0,1},knot'[u]}] . poly[v],
    {u,0,2 Pi},
    Exclusions->None, Boxed->False, Axes->False, Mesh->False, PlotPoints->40

enter image description here

  • $\begingroup$ Many thanks. These functions (and ideas) will give me something to gnaw on for a couple weeks. $\endgroup$
    – Rabbit
    Oct 8, 2017 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.