(* ZDE ZADEJTE KRIVKU *)
krivka[t_] := { Cos[t],Sin[t],t}
(* ZADEJTE ROZSAH T *)
mint = 0.00000;
maxt =4 Pi;
(* VYPOCET KRIVOSTI A TORZE *)
krivkaD1[t_] = D[krivka[t],t]; (* prvni derivace = c' *)
krivkaD2[t_] = D[krivkaD1[t],t]; (* druha derivace = c'' *)
krivkaD3[t_] = D[krivkaD2[t],t]; (* treti derivace = c''' *)
normD1[t_] = Norm[krivkaD1[t]]; (* norma prvni derivace = ||c'||*)
D1xD2[t_] = Cross[krivkaD1[t], krivkaD2[t]];  (* c' x c'' *)
normD1xD2[t_] = Norm[D1xD2[t]]; (* || c' x c'' || *)
(* KRIVOST A TORZE *)
"Krivost"
(* kapa = || c' x c'' || / ||c'||^3 *)
krivost[t_] := Simplify[normD1xD2[t]/normD1[t]^3,t ≥ mint && t≤maxt]
krivost[t]
"Torze"
(* torze = ( c' x c'' ) . c''' / ||c' x c''||^2 *)
torze[t_] := Simplify[(D1xD2[t] . krivkaD3[t])/(normD1xD2[t]^2),t ≥ mint && t≤maxt]
torze[t]
(* FRENETUV FRAPER *)
tangent[t_]=krivkaD1[t]/normD1[t]; (* Jen normalizace derivace krivky *)
normal0[t_] = krivkaD2[t] - tangent[t] * Dot[tangent[t],krivkaD2[t]]; (* Gramm - Schmidt *)
normal[t_] = Normalize[normal0[t]]; 
binormal[t_] = Cross[tangent[t],normal[t]]; (* T x B *)
Manipulate[Show[ParametricPlot3D[krivka[t],{t,mint,maxt},PlotStyle->Purple,
PlotRangePadding->1],
Graphics3D[{AbsolutePointSize[7],Purple,Point[krivka[t]]}],
Graphics3D[{AbsolutePointSize[5],Red,Point[krivka[t]+tangent[t]]}],
Graphics3D[{AbsolutePointSize[5],Green,Point[krivka[t]+normal[t]]}],
Graphics3D[{AbsolutePointSize[5],Blue,Point[krivka[t]+binormal[t]]}],
ParametricPlot3D[krivka[t]+s*tangent[t],{s,0,1},PlotStyle->{Thick,Red}],
ParametricPlot3D[krivka[t]+s*normal[t],{s,0,1},PlotStyle->{Thick,Green}],
ParametricPlot3D[krivka[t]+s*binormal[t],{s,0,1},PlotStyle->{Thick,Blue}]
,BoxRatios->Automatic],{t,mint,maxt}]

ParametricPlot3D[krivka[t]+1*(normal[t]*Cos[u]+binormal[t]*Sin[u]),{t,mint,maxt}, {u,0,2Pi},
PlotRangePadding->1]

phi[t_]=Integrate[-torze[u]*normD1[u], {u, mint, t}]

N[phi[0]]

V[t_]:=normal[t]*Cos[phi[t]]+binormal[t]*Sin[phi[t]]

W[t_]:=-normal[t]*Sin[phi[t]]+binormal[t]*Cos[phi[t]]

ParametricPlot3D[krivka[t]+1*(V[t]*Cos[u]+W[t]*Sin[u]),{t,mint,maxt}, {u,0,2Pi},
PlotRangePadding->1]

Manipulate[Show[ParametricPlot3D[krivka[t],{t,mint,maxt},PlotStyle->Purple,
PlotRangePadding->1],
Graphics3D[{AbsolutePointSize[7],Purple,Point[krivka[t]]}],
Graphics3D[{AbsolutePointSize[5],Red,Point[krivka[t]+tangent[t]]}],
Graphics3D[{AbsolutePointSize[5],Green,Point[krivka[t]+V[t]]}],
Graphics3D[{AbsolutePointSize[5],Blue,Point[krivka[t]+W[t]]}],
ParametricPlot3D[krivka[t]+s*tangent[t],{s,0,1},PlotStyle->{Thick,Red}],
ParametricPlot3D[krivka[t]+s*V[t],{s,0,1},PlotStyle->{Thick,Green}],
ParametricPlot3D[krivka[t]+s*W[t],{s,0,1},PlotStyle->{Thick,Blue}]
,BoxRatios->Automatic],{t,mint,maxt}]