MathGroup Archive 2012

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

Search the Archive

Re: tubes program not working in version 9

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129004] Re: tubes program not working in version 9
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sat, 8 Dec 2012 01:28:36 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20121207063953.888006934@smc.vnet.net>

The code that you posted does not define values for either p0 or q0.
However, even with these defined, I obtained radically different
surfaces depending on whether the intermediate results are simplified.

$Version

"9.0 for Mac OS X x86 (64-bit) (November 20, 2012)"

Clear[p0, q0];

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

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

Column[Table[With[{p0 = n, q0 = m},
   r = Cos[q0*t] + 2;
   x = r*Cos[p0*t];
   y = r*Sin[p0*t];
   z = Sin[q0*t];
   w0 = 8*{x, y, z};
   Row[{
     h1 = TubePlotFrenet[w0, {t, 0, 2 \[Pi]}, 1,
       Axes -> None,
       Boxed -> False,
       PlotPoints -> {64, 16},
       ColorFunction -> "CandyColors",
       MeshFunctions -> {#3 &},
       ImageSize -> 228,
       BoxRatios -> {1, 1, 1},
       PlotLabel -> StringForm[
         "h1: p0 = ``, q0 = ``", p0, q0]],
     h2 = TubePlotFrenet2[w0, {t, 0, 2 \[Pi]}, 1,
       Axes -> None,
       Boxed -> False,
       PlotPoints -> {64, 16},
       ColorFunction -> "CandyColors",
       MeshFunctions -> {#3 &},
       ImageSize -> 228,
       BoxRatios -> {1, 1, 1},
       PlotLabel -> StringForm[
         "h2: p0 = ``, q0 = ``", p0, q0]]}]],
  {n, {-1, 1}}, {m, {-1, 1}}]]


Bob Hanlon


On Fri, Dec 7, 2012 at 1:39 AM, Roger Bagula <roger.bagula at gmail.com> wrote:
> The problem seems to be sometimes it works but mostly it doesn't.
> The tubes program was written for an earlier version
> ( works in version 5 I think) by Mark McClure
> and has worked fine for literally years.
> I haven't got a clue what has gone wrong.
> ( technically these are called channel surfaces or the like).
>
> TubePlotFrenet[curve_List, {var_, min_, max_}, radius_, opts___] :=
>  Module[{tangent, unitTangent, normal, unitNormal, biNormal},
>   tangent = D[curve, t];
>   unitTangent = tangent/Sqrt[tangent.tangent];
>   normal = D[unitTangent, t];
>   unitNormal = normal/Sqrt[normal.normal];
>   biNormal = Cross[unitTangent, unitNormal];
>   ParametricPlot3D[
>    curve + radius Cos[s] unitNormal + radius Sin[s] biNormal //
>     Evaluate, {var, min, max}, {s, 0, 2 \[Pi]}, opts]]
>
> r = Cos[q0*t] + 2;
> x = r* Cos[p0*t];
> y = r *Sin[p0*t];
> z = Sin[q0*t];
> w0 = 8*{x, y, z}
> h = TubePlotFrenet[w0, {t, 0, 2 \[Pi]}, 1, Axes -> None,
>   Boxed -> False, PlotPoints -> {64, 16},
>   ColorFunction -> "CandyColors", MeshFunctions -> {#3 &}]
>
> My other tubes program which came from an answer in this group
> still works.
>



  • Prev by Date: Re: Pet peeve about version numbers of Mathematica
  • Next by Date: when is y=x+a not a straight line?
  • Previous by thread: tubes program not working in version 9
  • Next by thread: Re: tubes program not working in version 9