Tube

Author

Eric W. Weisstein
October 6, 2005

This notebook downloaded from http://mathworld.wolfram.com/notebooks/SolidGeometry/Tube.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Tube.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Code

TorusKnot[{a_,b_,c_},{p_,q_},t_]:={(a+b Cos[q t])Cos[p t],(a+b Cos[q t])Sin[p t],c Sin[q t]}

Unit[v_]:=v/Sqrt[v.v]
Tube[r_,{t_,a_,b_},R_,opts___]:=Module[
{
tangent=Unit[D[r,t]],
normal,
binormal
},
normal=Unit[D[tangent,t]];
binormal=Cross[normal,tangent];
ParametricPlot3D[Evaluate[r+R(-Cos[theta]normal+Sin[theta]binormal)],
{t,a,b},{theta,0,2Pi},opts,DisplayFunction->Identity][[1]]
]

Examples

Show[GraphicsArray[Partition[Graphics3D[#,Boxed->False]&/@
{
Tube[{Cos[t],Sin[t],1},{t,0,2Pi},.2,PlotPoints->{30,10}],
Tube[{.2t,Cos[t],Sin[t]},{t,0,30},.2,PlotPoints->{70,10}],
Tube[TorusKnot[{8,3,5},{2,3},t],{t,0,2Pi},1,PlotPoints->{80,8}],
Tube[TorusKnot[{8,3,5},{2,5},t],{t,0,2Pi},1,PlotPoints->{80,8}]
},2]
],GraphicsSpacing->-.1]