Arc length

This notebook illustrates the concept of arc length and curvature.

Length L of curve x(t) over [0,t],  where (Subscript[x, i])=x((Subscript[t, i])) and Δ(Subscript[x, i]) =  x((Subscript[t, i+1]))  - x((Subscript[t, i])):


	L = (Subscript[Σ, i=0]^(n-1)) ‖ Δ(Subscript[x, i]) ‖  =  (Subscript[Σ, i=0]^(n-1))((‖Δ(Subscript[x, i])‖)/h)·h    hence    (lim_(h→0)) L = (∫_(0 )^t)‖(Overscript[x, ·])(τ)‖dτ
	
Normalized tangent vector  t =  (( (Overscript[x, ·]))/((Overscript[‖ x,       ·])‖))  has   (Overscript[t, ·]) · t  = 0

Needs["VectorAnalysis`"]

arc[t_]:= NIntegrate[Norm[D[eval[s]]],{s,0,t}]; (* curve length from 0 to t *)
Print["eval arc = ",arc[1.0]//N];

n=5;  (* degree *)
ll=7;  (* domain intervals *)
knot=Join[Table[0,{i,0,n}],Table[i/ll,{i,1,ll-1}],Table[1,{i,0,n}]]//N;
ll=Length[knot]-2*n-1; (* domain intervals *)

dd=Table[{Cos[0.6t],Sin[0.6t],0.2*t},{t,0,ll+n-1,1}]//N;

dd=Table[{t,Sqrt[t]+0.3RandomReal[],0.1t^2},{t,0,ll+n-1,1}]//N;

points=Graphics3D[{Red,PointSize[0.025],Point[dd]}]; (*quntic, ll =7 *)

ddplot=Graphics3D[{Thick,Line[dd]}];

curve[t_]:=Sum[BSplineBasis[{n,knot},i,t]*dd[[i+1]],{i,0,n+ll-1}]//N;
first[t_]:=(curve[t+0.0001]-curve[t])/0.0001;
second[t_]:= (first[t+0.0001]-first[t])/0.0001;
binormal[t_]:=Cross[first[t],second[t]];
normal[t_]:=Cross[first[t],binormal[t]]/Norm[Cross[first[t],binormal[t]]];
kappa[t_]:=Norm[Cross[first[t],second[t]]]/(Norm[first[t]])^3;
firstsurf[t_,u_]:=curve[t]+u*first[t];
kappasurf[t_,u_]:=curve[t]+3u*kappa[t]*normal[t];

cplot=ParametricPlot3D[curve[t],{t,knot[[1]],knot[[2n+ll+1]]},PlotStyle->{Thick,Green},Boxed-> False,ViewPoint->{-1.8,-1,1.7}];

Explore arc length :

num=1000;
length=Table[0.0, {i,1,num}];
delt=(knot[[ 2n+ll+1]] - knot[[1]])/num;
arcs=Table[Norm[curve[(i+1)*delt]-curve[i*delt]],{i,1,num}];
length[[1]]=0.0;
Do[length[[i+1]]=length[[i]]+arcs[[i]],{i,1,num-1}]
ListLinePlot[length,Filling-> Axis]

curve[0.5]
arc[t_]:= NIntegrate[Norm[first[tau]],{tau,0,t}];
arc[0.5]

Plot[arc[t],{t,0,1}]

Explore curvature :

kappasurfplot=ParametricPlot3D[kappasurf[t,u],{t,knot[[1]],knot[[2n+ll+1]]},{u,0,1},Boxed-> False,Mesh->None,Axes->False,PlotRange->Automatic,ViewPoint->{-1.8,-1,1.7}];

Plot[kappa[t],{t,knot[[1]],knot[[2n+ll+1]]-0.0003},Filling->Bottom,AxesOrigin->{0,0}]

Show[{  kappasurfplot,cplot}]