# Tubes!

The Mathematica code below inflates a curve to produce a tube!

(* Refactoring of Curve-to-tube recipe *) CoreObj[t_] = {Sin[4t], Cos[3t], Sin[5t]}; (* This defines the curve to be tubed *) FirstD[t_] = D[CoreObj[t],t]; (* This defines the tangent vector at t *) FirstNV[t_] = {FirstD[t][[2]] - FirstD[t][[3]], FirstD[t][[3]] - FirstD[t][[1]],FirstD[t][[1]] - FirstD[t][[2]]}; (* this defines a normal vector to the curve*) SecondNV[t_] = FirstD[t] \[Cross] FirstNV[t]; (* this defines a mutually orthogonal vector to both the tangent and normal vector *) NNV1[t_] = Normalize[FirstNV[t]]; NNV2[t_] = Normalize[SecondNV[t]]; (* creates unit vectors *) radius = 0.15; (* defines radius of tube *) TubeObj[u_,v_] = CoreObj[u] + radius *(Sin[v]NNV1[u] + Cos[v]NNV2[u]); ParametricPlot3D[TubeObj[u,v],{u,0,2 \[Pi]},{v,0,2 \[Pi]},Mesh->100,MeshFunctions->Automatic]Changing the CoreObj changes the underlying curve, some apparent favourites from 2013 were

- the trefoil knot $$\{\sin(t) + 2\sin(2t), \cos(t) - 2\cos(2t), -\sin(3t)\}$$

- Log in to post comments