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

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.)

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]

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

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

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

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.

Chris,

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

Rohit,

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

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