MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Tube plot function in Mathematica???

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108578] Re: Tube plot function in Mathematica???
  • From: Mark McClure <mcmcclur at unca.edu>
  • Date: Wed, 24 Mar 2010 04:41:50 -0500 (EST)

On Tue, Mar 23, 2010 at 6:52 AM, NeuroPulse <cosmicvoyager at gmail.com> wrote:

> New to Mathematica.  Can't seem to find a way to plot a line as a tube
> like this:
> http://facstaff.unca.edu/mcmcclur/java/LiveMathematica/trefoil.html

The TubePlotFrenet command and the TubePlot command are defined on this webpage:
http://facstaff.unca.edu/mcmcclur/java/LiveMathematica/tubes.html

I did all that quite some time ago and quite a lot of things have
changed since then.  There is now a Tube primitive that can generate
nice tubes like so:

trefoil[t_] == {Sin[3 t], Sin[t] + 2 Sin[2 t], Cos[t] - 2 Cos[2 t]};
Graphics3D[{Tube[BezierCurve[Table[trefoil[t],
     {t, 0., 2 Pi, Pi/200}]], 0.4]}]


If you still want to try my old TubePlot functions, there are a couple
of things that should be changed.  First, a few Simplify commands will
speed things up again.  Second, the Lighting specificiations on my
webpage are obsolete.  Putting it all together, you can generate a
nice image like so:

TubePlotFrenet[curve_List, {var_, min_, max_}, radius_, opts___] :==
  Module[{tangent, unitTangent, normal, unitNormal, biNormal},
   tangent == D[curve, t];
   unitTangent == Simplify[tangent/Sqrt[tangent.tangent]];
   normal == D[unitTangent, t];
   unitNormal == Simplify[normal/Sqrt[normal.normal]];
   biNormal == Simplify[Cross[unitTangent, unitNormal]];
   ParametricPlot3D[Evaluate[curve +
      radius Cos[s] unitNormal + radius Sin[s] biNormal],
    {var, min, max}, {s, 0, 2 Pi}, opts]];

trefoil[t_] == {Sin[3 t], Sin[t] + 2 Sin[2 t], Cos[t] - 2 Cos[2 t]};
TubePlotFrenet[trefoil[t], {t, 0, 2*Pi}, 0.3,
 Axes -> None, Mesh -> Full, Boxed -> False,
 ViewPoint -> {10, 0, 0}, PlotPoints -> {64, 16}]

Hope that helps,
Mark McClure


  • Prev by Date: Probability Histogram Problems
  • Next by Date: Re: ListContourPlot3D
  • Previous by thread: Re: Tube plot function in Mathematica???
  • Next by thread: Re: Tube plot function in Mathematica???