Debra Woods

Local Coordinate system

Brief Description:

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>.

run initializations first

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}]]];
			
Cross[a_?VectorQ,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[];
Null

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];

(****   set function   ****)

x[t_] = 2 Cos[t];
y[t_] = 2 Sin[t];
z[t_] = (t^2)/20;
P[t_] = {x[t],y[t],z[t]};

(****  set start and stop values for t   ****)  

start := 0;  stop := 4 Pi;   inc := Pi/4; 
  
(****   Calculate tangent and normal vectors   ***)

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[{Cross[unitT[pos],unitN[pos]]+P[pos],
																		P[pos]}]}];
(****   Plot of space curve   ***)
curveplot =
     ParametricPlot3D[Append[P[t],Purple],
                      {t,start,stop},
                      DisplayFunction->Identity];

(****   Plot of 3 dimensional axes   ****)

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};

(****  Create table of space curve, and  vectors ,,,   and display table   ***)

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.