# Envelopment of space curves

Creating sculptural forms

The respondents showed how to envelop space curves with a net-like structure. I used kglr's answer to create the following function:

Envelopment[fn_, pr_, le_, tr_, me_] :=

Show[
ParametricPlot3D[fn[pr Pi t], {t, 0, 1},
Axes -> False,
Background -> Black,
Boxed -> False,
ImageSize -> Large,
Lighting -> "ThreePoint",
PlotRange -> All,

ParametricPlot3D[
v fn[pr Pi t] + (1 - v) fn[pr Pi (t + le)], {t, 0, 1}, {v, 0, 1},
BoundaryStyle -> Directive[White, Thin],
Mesh -> {me},
MeshFunctions -> {#4&},
MeshStyle -> Directive[White, Thin],
PlotStyle -> FaceForm[]],

SphericalRegion -> True]


We use KnotData to create an anonymous function:

knot = KnotData[{3, 1}, "SpaceCurve"]


{Sin[#1] + 2 Sin[2 #1], Cos[#1] - 2 Cos[2 #1], -Sin[3 #1]} &

Envelopment[knot, 4, 0.06, 0.05, 300]


For testing purposes, I included two more curves.

noeud = {2 Cos[#] - 2 Cos[3 #], 2 Sin[#] + 2 Sin[3 #], Sin[4 #]} &;

Envelopment[noeud, 4, 0.05, 0.08, 250]


conical = {# Cos[3 #] - 1, # Sin[3 #], #} &;

Envelopment[conical, 3, 0.06, 0.2, 300]


My question

I want to replace the mesh lines with a semi-transparent coloured band following the curve path. Approximately like in this image, which I found by chance on the internet:

How can we achieve this - optionally with or without the tube?

• Thanks for editing, @user84456
– eldo
Jan 14 at 17:18

ClearAll[curveToStrip, parametricStrip]

curveToStrip[f_, sw_ : 1] := f[#] +
sw  ( 1 - #2)/ 2  (FrenetSerretSystem[f[$$u],$$u][[2, 2]] /. \$u -> #) &

parametricStrip[opts : OptionsPattern[]][f_, sw_: 1, sc_: 2 Pi, tr_ : .05] :=
ParametricPlot3D[
Evaluate[curveToStrip[f, sw][sc  t, v]],
{t, 0, 1}, {v, 0, 1},
opts,
BoundaryStyle -> None,
MeshFunctions -> {#5 &} ,
Mesh -> {{0, 1}},
Method -> {"BoundaryOffset" -> False},
Lighting -> "ThreePoint",
PlotPoints -> 120,
Axes -> False,
Boxed -> False,
ImageSize -> Large,
Background -> Black,
SphericalRegion -> True]


Examples:

knot = KnotData[{3, 1}, "SpaceCurve"];

parametricStrip[][knot]


Use the option Mesh to specify multiple mesh lines with different styles:

parametricStrip[Mesh ->


parametricStrip[Mesh -> None,
PlotStyle -> Automatic,
ColorFunction -> (ColorData["TemperatureMap"][#4] &),
"Extrusion" -> .5 ][knot]


Replace "Extrusion" -> .5 with PlotTheme -> "ThickSurface" to get

noeud = {2 Cos[#] - 2 Cos[3 #], 2 Sin[#] + 2 Sin[3 #], Sin[4 #]} &;



conical = {# Cos[3 #] - 1, # Sin[3 #], #} &;

parametricStrip[ViewPoint -> {-3, -1, 1}][conical, #/2]


• +1 for the Tube[tr] bit, didn't know! Jan 15 at 8:07
• Thank you, kglr, a wonderful solution. Please add for future reference: Eliminate MeshStyle->..., Lighting->... and PlotStyle->... and add ColorFunction -> "TemperatureMap" and PlotTheme -> "ThickSurface"
– eldo
Jan 15 at 8:17
– kglr
Jan 15 at 8:30

Try:

Envelopment[fn_, pr_, le_, tr_, me_] :=
Show[ParametricPlot3D[fn[pr Pi t], {t, 0, 1}, Axes -> False,
Background -> Black, Boxed -> False, ImageSize -> Large,
Lighting -> "ThreePoint", PlotRange -> All],
ParametricPlot3D[
v fn[pr Pi t] + (1 - v) fn[pr Pi (t + le)], {t, 0, 1}, {v, 0, 1},
BoundaryStyle -> Directive[White, Thin],
PlotStyle -> {Opacity[0.2], Red}], SphericalRegion -> True]