Message Boards Message Boards


Best way to produce interactive 3d images of tangles/knots?

Posted 2 months ago
6 Replies
7 Total Likes

On my html5 website on physics, I would like to add 3d computer graphics of tangles. (Tangles are cousins of knots.) The tangles would be similar to the one in the following photograph. I would like to allow users to rotate the image of such a tangle and thus allow them to view the tangle from all sides.

Question1 : How can I generate such a tangle most easily in Mathematica?

Question 2: What is the best 3d format to export it, and what is the best/easiest way to embed the 3d image in a html5 page, so that viewers can rotate the image with their mouse or with sliders?

(P.S. Tubular ropes are completely sufficient, without any substructure. P.P.S. Apart from Mathematica, I also own KnotPlot.)

A tangle photograph

6 Replies
Posted 2 months ago

Hi Chris,

For knots you can use KnotData. e.g. for an interactive 3D image

KnotData[{"TorusKnot", {3, 5}}, "Image"]

One way to customize the appearance is to get the functional form and plot it

f = KnotData[{"TorusKnot", {3, 5}}, "SpaceCurve"];
ParametricPlot3D[f[t], {t, 0, 2 Pi},
  ViewPoint -> {Pi/2, Pi/2, 2},
  Axes -> False,
  Boxed -> False,
  ColorFunction -> "Rainbow",
  PlotRange -> All] /. Line[pts_, rest___] :> Tube[pts, 0.2, rest]

enter image description here

Not sure how to add an interactive version to your website. Maybe you can use one of the supported 3D export formats.

Posted 2 months ago

Thank you - are there also pre-defined tangles in Mathematica?

Posted 2 months ago

And another question: which of the several dozen predefined 3d formats is the best to add it into html?

Posted 2 months ago

I am not aware of any pre-defined tangles in Mathematica, perhaps someone else knows.

For embedding the export into a web page, check this post on MSE. Nice interactive example linked from that post.

Posted 2 months ago


In case you are wondering, "Updating Name" was me. It is a longstanding bug on this site.

Posted 2 months ago


thank you, that is an excellent answer. Very helpful.

Now, I just have to learn how to create tangle images.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract