Local Coordinate Systems

Debra Woods

Brief Description:  This code demonstrates the tangent, normal, binormal system (local coordinate system) as it moves along a circular helix

initializations

Vector Drawers

Off[General::"spell1"]; Off[ParametricPlot3D::"ppcom"]; Off[ParametricPlot::"ppcom"]; BeginPackage["Vectors3D`", "Graphics`Colors`"]; Perp::"usage" = 
      "Perp[expr] returns a single 3-d vector which is   perpendicular to \
the vector, 'expr'."; Cross::"usage" = 
      "Cross[a,b] returns the cross product of a and b."; Norm::"usage" = 
      "Norm[expr] returns the Euclidean length of the  vector, 'expr'."; 
    Begin["`Private`"]; SetOptions[ParametricPlot, AspectRatio -> Automatic]; SetOptions[Plot, AspectRatio -> Automatic]; SetOptions[Graphics, AspectRatio -> Automatic]; Perp[a_?VectorQ] := 
      If[a[[1]] == 0, Return[{1, 0, 0}], 
        If[a[[2]] == 0, 
          Return[{0, 1, 0}], 
          Return[{-a[[2]], 
              a[[1]], 0}]]]; a_?VectorQ\[Cross]b_?VectorQ := {
        a[[2]] 
            b[[3]] - 
          a[[3]] 
            b[[2]], 
        a[[3]] 
            b[[1]] - 
          a[[1]] 
            b[[3]], 
        a[[1]] 
            b[[2]] - 
          a[[2]] 
            b[[1]]}; Norm[a_?VectorQ] := (Sqrt[a . a]); End[]; EndPackage[];

Local Coordinate Systems

r(t) = {2 cos t, 2 sin t, (t/20)}

This code demonstrates the tangent, normal, binormal system (local coordinate system) as it moves along a circular helix 
r(t) = {2 cos t, 2 sin t, (t/20)}
It is easy for the user to plug in their own function (parametrically) and start/stop values.

Clear[x, y, z, t, P, pos, unitT, unitN, Bvector, start, stop, inc]; x[t_] = 2 Cos[t]; y[t_] = 2 Sin[t]; z[t_] = ((t^2)/20); P[t_] = {x[t], y[t], z[t]}; start := 0; stop := 4 π; inc := (π/4); unitT[t_]=((P'[t])/(Norm[P'[t]]));unitN[t_]=((P''[t])/(Norm[P''[t]]));Clear[tangentvector, unitnormalvector, Bvector]tangentvector[pos_] := 
      Graphics3D[{RGBColor[0, 0, 1], Thickness[0.01], 
          Line[{P[pos], P[pos] + unitT[pos]}]}]; unitnormalvector[pos_] := 
      Graphics3D[{RGBColor[0, 0, 1], Thickness[0.01], 
          Line[{unitN[pos] + P[pos], P[pos]}]}]; Bvector[pos_] := 
      Graphics3D[{RGBColor[0, 0, 1], Thickness[0.01], 
          Line[{unitT[pos]\[Cross]unitN[pos] + P[pos], P[pos]}]}]; curveplot = 
      ParametricPlot3D[Append[P[t], Purple], {t, start, stop}, 
        DisplayFunction -> Identity]; spacer = 0.2; h = 5; threedims = 
      Graphics3D[{{Line[{{-h, 0, 0}, {h, 0, 0}}]}, 
          Text["x", {h + spacer, 0, 0}], {
            Line[{{0, -h, 0}, {0, h, 0}}]}, 
          Text["y", {0, h + spacer, 0}], {Line[{{0, 0, 0}, {0, 0, h}}]}, 
          Text["z", {0, 0, h + spacer}]}]; CMView = {1.75, 1.224, 1.7}; Table[Show[threedims, curveplot, tangentvector[pos], 
        unitnormalvector[pos], Bvector[pos], Boxed -> False, 
        ViewPoint -> CMView, DisplayFunction -> $DisplayFunction], {
        pos, start, stop, inc}];

Select the cells and press command-y to animate the graphic.

I plan to further develop this lesson at a later time to include missile trajectories, and curvature.