4
$\begingroup$

I would like to animate (continuously) a plane with any number of curves on it folding into a cylinder (and also seeing the resulting curves -arbitrary curves, really- in the cylinder - folded lines would be the geodesics of the cylinder, circles would be sort of pseudo-geodesics, and so on). I've thought a lot about this problem but haven't found any way to actually implement what I'm thinking of (I don't even know if there is really a way, so it's worth asking). I'm aware it's simple to do this without the curves part, but I haven't been able to adapt it.

$\endgroup$
3
  • $\begingroup$ Possible duplicate: Wrapping a rectangle to form a cylinder $\endgroup$ Sep 12, 2018 at 0:35
  • $\begingroup$ @VitaliyKaurov That's exactly why I wrote: "I'm aware it's simple to do this without the curves part, but I haven't been able to adapt it." $\endgroup$ Sep 12, 2018 at 0:36
  • $\begingroup$ Please provide an example of what exactly you want to wrap. $\endgroup$
    – Kuba
    Sep 13, 2018 at 6:05

1 Answer 1

7
$\begingroup$

I take the solution from the linked QA, but slightly change the parametrization:

Manipulate[
 ParametricPlot3D[
  {Sinc[a u] u, v, 1/a - Cos[a u]/a}, {u, 0, 2 Pi}, {v, 0, 2 Pi},
  ImageSize -> {300, 300}, Mesh -> {{0.}}, 
  MeshFunctions -> {#4 - #5 &},
  BoxRatios -> {3 \[Pi], 2 \[Pi], 4}, 
  PlotRange -> {{-\[Pi], 2 \[Pi]}, {0, 2 \[Pi]}, {0, 4}},
  PlotStyle -> Directive[Opacity[0.7], Orange, Specularity[White, 50]],
  ViewPoint -> {0, 1, -2}, ViewVertical -> {0, 1, 0},
  BoundaryStyle -> Directive[Black, Opacity[.3]]
  ],
 {{a, .01, "wrap"}, 0.001, 1}
 ]

This way we start with a 2Pi*2Pi sheet in the x-y plane with one vertex fixed at (0,0,0). Slots #4 and #5 correspond to the x-y coordinates of that sheet (not the 3-d space), I'll call them u and v. Let's say, we want to look at how the line u - v == 0 wraps into a cylinder. We pass the MeshFunction -> {#4 - #5 &} option (alternatively, we could write Function[{x,y,z,u,v}, u - v]) for the left hand side of the equation u - v == 0. and pass Mesh -> {{0.}} for the right hand side.

Check it out.

enter image description here

As far as the question in the comments goes: In my example the sheet is in (0,0)-(2Pi,2Pi). Let's say, we want to put a spiral in the center, in terms of u and v it would be `{u[t], v[t]} == {Pi + t/10 Cos[t], Pi + t/10 Sin[t]}.

We use the very same expression as for the sheet above:

Function[{u,v}, {Sinc[a u] u, v, 1/a - Cos[a u]/a}]

and apply it to the parametric definition of the spiral like so:

Function[{u, v}, {Sinc[a u] u, v, 1/a - Cos[a u]/a}] @@ {
      Pi + t/10 Cos[t], Pi + t/10 Sin[t]}

Manipulate[
 Show[{
   ParametricPlot3D[{Sinc[a u] u, v, 1/a - Cos[a u]/a}, {u, 0, 
     2 Pi}, {v, 0, 2 Pi},
    ImageSize -> {300, 300}, Mesh -> {{0.}}, 
    MeshFunctions -> {#4 - #5 &}, BoxRatios -> {3 \[Pi], 2 \[Pi], 4},
    PlotRange -> {{-\[Pi], 2 \[Pi]}, {0, 2 \[Pi]}, {0, 4}}, 
    PlotStyle -> Directive[Opacity[0.7],
      Orange, Specularity[White, 50]], ViewPoint -> {0, 1, -2}, 
    ViewVertical -> {0, 1, 0},
    BoundaryStyle -> Directive[Black, Opacity[.3]]],

   ParametricPlot3D[
    Function[{u, v}, {Sinc[a u] u, v, 1/a - Cos[a u]/a}] @@ {
      Pi + t/10 Cos[t], Pi + t/10 Sin[t]},
    {t, 0, 10 Pi}]

   }], {{a, .01, "wrap"}, 0.001, 1}]

enter image description here

Here is the generalized approach for arbitrary-sized sheets. I've included k and h as parameters that determine the size of the sheet in the Manipulate to yield a sheet sized 2 Pi k by h

Manipulate[Show@{
   ParametricPlot3D[
    {Sinc[a u/ k] u, v, k/a - k Cos[a u/k]/a}, {u, 0, 2 Pi k}, {v, 0, h},
    ImageSize -> {300, 300}, BoxRatios -> {k 3 \[Pi], h, 4 k},
    PlotRange -> {k {-\[Pi], 2 \[Pi]}, {0, h}, k {0, 4}}, Mesh -> None,
    PlotStyle -> 
     Directive[Opacity[0.7], Orange, Specularity[White, 50]],
    ViewPoint -> {0, 1, -2}, ViewVertical -> {0, 1, 0},
    BoundaryStyle -> Directive[Black, Opacity[.3]]],

   ParametricPlot3D[
    Function[{u, v}, {Sinc[a u/ k] u, v, k/a - k Cos[a u/k]/a}] @@
     {Pi + t/10 Cos[t], Pi + t/10 Sin[t]}, {t, 0, 10 Pi}]},

 {{a, .01, "wrap"}, 0.001, 1},
 {{k, 2, "u-length"}, 0.1, 4},
 {{h, 1, "v-length"}, 0.1, 10}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$
    – Kuba
    Sep 13, 2018 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.