Function Repository Resource:

CurvatureTorsionPlot3D

Source Notebook

Plot a curve defined by its curvature and torsion

Contributed by: Alfred Gray

ResourceFunction["CurvatureTorsionPlot3D"][{κ,τ},{t,tmin,tmax},{a0,p,q,r}]

plots the curve c defined by its curvature κ and torsion τ, written as functions of t and having initial conditions c(a0)=p,c'(a0)=q and c''(a0)=κ(a0)r.

ResourceFunction["CurvatureTorsionPlot3D"][{κ,τ},{t,tmin,tmax}]

plots the curve using default initial conditions.

ResourceFunction["CurvatureTorsionPlot3D"][{{κ1,τ1},},{t,tmin,tmax}]

plots several curves defined by their curvatures κi and torsions τi.

Details and Options

Default initial conditions for the curve c are c(a0)={0,0,0}, c'(a0)={1,0,0} and c''(a0)=κ(a){0,1,0}, where κ is the curvature.
ResourceFunction["CurvatureTorsionPlot3D"] has the same options as ParametricPlot and NDSolve.

Examples

Basic Examples (9) 

Zero torsion gives a plane curve:

In[1]:=
ResourceFunction[
 "CurvatureTorsionPlot3D"][{10/(t + 11), 0}, {t, -10, 10}]
Out[1]=

Constant curvature and torsion gives a helix:

In[2]:=
ResourceFunction["CurvatureTorsionPlot3D"][{1, 1}, {t, -5, 5}]
Out[2]=

Linear curvature and constant torsion:

In[3]:=
ResourceFunction["CurvatureTorsionPlot3D"][{t, 1}, {t, -10, 10}]
Out[3]=

Linear curvature and torsion:

In[4]:=
ResourceFunction["CurvatureTorsionPlot3D"][{t, t}, {t, -5, 5}]
Out[4]=

Constant curvature and linear torsion:

In[5]:=
ResourceFunction["CurvatureTorsionPlot3D"][{1, t}, {t, -5, 5}]
Out[5]=

Constant curvature and sinusoidal torsion:

In[6]:=
ResourceFunction[
 "CurvatureTorsionPlot3D"][{1.3, .5 Sin[t]}, {t, 0, 10 \[Pi]}]
Out[6]=

Sine-cosine curvature and torsion:

In[7]:=
ResourceFunction[
 "CurvatureTorsionPlot3D"][{ Sin[t], Cos[t]}, {t, -10, 300}, PlotPoints -> 200, Axes -> None]
Out[7]=

Using a sawtooth wave curve:

In[8]:=
ResourceFunction[
 "CurvatureTorsionPlot3D"][{5 SawtoothWave[t], Sin[t]}, {t, -10, 100},
  BoxRatios -> {1, 1, 1}, PlotPoints -> 200, Axes -> None]
Out[8]=

Increasing torsion ends in a closed curve:

In[9]:=
Partition[
  Table[ResourceFunction[
    "CurvatureTorsionPlot3D"][{1, 1/12 n Sin[t]}, {t, 0, 4 \[Pi]}, Axes -> None, Boxed -> False, ViewPoint -> {1, 1, 2}], {n, 12}], 4] // GraphicsGrid
Out[9]=

All graphics together:

In[10]:=
ResourceFunction["CurvatureTorsionPlot3D"][
 Table[{1, 1/12 n Sin[t]}, {n, 12}], {t, 0, 4 \[Pi]}, Axes -> None, Boxed -> False, ViewPoint -> {1, 1, 2}]
Out[10]=

Animate the evolution of the curve:

In[11]:=
Animate[ResourceFunction[
  "CurvatureTorsionPlot3D"][{1, 1/12 n Sin[t]}, {t, 0, 4 \[Pi]}, Axes -> None, Boxed -> False, ViewPoint -> {1, 1, 2}], {{n, 5}, 1, 12}]
Out[11]=

Options (1) 

ColorFunction (1) 

Apply a color function:

In[12]:=
ResourceFunction[
 "CurvatureTorsionPlot3D"][{Abs[t], .3}, {t, -10, 10}, {0, {0, 0, 0}, {1, 0, 0}, {0, 1, 0}}, PlotPoints -> 200, Axes -> None, ColorFunction -> "BlueGreenYellow"]
Out[12]=

Properties and Relations (2) 

Get a curve with prescribed curvature (intrinsic curvature):

In[13]:=
intrinsic[f_, a_, {c_, d_, e_}, {min_, max_}][t_] := Module[{x, y, \[Theta], s, eqic, sol}, eqic = {Derivative[1][x][s] == Cos[\[Theta][s]], Derivative[1][y][s] == Sin[\[Theta][s]], Derivative[1][\[Theta]][s] == f[s], x[a] == c, y[a] == d, \[Theta][a] == e}; sol = NDSolve[eqic, {x, y, \[Theta]}, {s, min, max}]; {x[t], y[t]} /. sol[[1]]];

Plot a surface of revolution:

In[14]:=
Module[{rad = 1, int = intrinsic[-Sin[#] & , 0, {0, 0, 0}, {-10, 10}][v]}, Show[ParametricPlot3D[
   Evaluate[{Cos[u] (rad + int[[1]]), Sin[u] (rad + int[[1]]), int[[2]]}], {u, 0, 2 \[Pi]}, {v, -10, 10}, Mesh -> False, PlotStyle -> Opacity[.5], MaxRecursion -> 3]]]
Out[14]=

Another way to generate a surface with from a curve with intrinsic curvature is by using GeneralizedHelicoid:

In[15]:=
f := intrinsic[-# & , 0, {0, 0, 0}, {-5, 5}]
In[16]:=
With[{heli = ResourceFunction[
ResourceObject[<|"Name" -> "GeneralizedHelicoid", "ShortName" -> "GeneralizedHelicoid", "UUID" -> "c02813fc-650a-487a-8440-770ef3bbb5db", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Compute the generalized helicoid of a curve",
        "RepositoryLocation" -> URL[
        "https://www.wolframcloud.com/objects/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$b5251ee2a1154483950ff86636e4c3c2`GeneralizedHelicoid", "FunctionLocation" -> CloudObject[
        "https://www.wolframcloud.com/obj/8b8ae647-25d6-4595-903c-37ec6d3616a2"]|>, ResourceSystemBase -> Automatic]][f[v], 0.2, u]}, Show[ParametricPlot3D[heli, {u, 0, 3 \[Pi]/2}, {v, -5, 5}, PlotPoints -> {30, 60}, Mesh -> False, PlotStyle -> Opacity[.5],
    MaxRecursion -> 3], ParametricPlot3D[heli /. u -> 0, {v, -5, 5}, Mesh -> False, PlotStyle -> {Opacity[.5], Red}, MaxRecursion -> 3]]
 ]
Out[16]=

Publisher

Enrique Zeleny

Version History

  • 1.0.0 – 23 June 2020

Source Metadata

Related Resources

Author Notes

This function was designed to be consistent with the resource function CurvaturePlot.

License Information