Message Boards Message Boards


[GIF] Separation Anxiety (Level sets of the torus)

Posted 3 years ago
1 Reply
5 Total Likes

Level sets of the torus

Separation Anxiety

The last GIF got me thinking more about cross sections of the torus, so here's a loop showing several. Of course, this makes me wonder about other interesting visualizations of Morse theory, so maybe that will be my next GIF.

I got frustrated trying to implement this using Graphics3D and Line, so I got lazy and just used ParametricPlot3D. The problem is that my level set function actually splits the level sets into two parts (corresponding to the two connected components when the level set becomes disconnected), and the two sides don't match up when the level sets are connected unless I use a ridiculous number of points.

To make the GIF I used PlotPoints -> 5000, which is slightly insane and certainly far too many to get a responsive Manipulate. The below code uses PlotPoints -> 200, which looks kind of crappy, but was good enough to play around with viewpoints and colors and so forth. Anyway, if you want to make your own GIF (and don't want to come up with better code), crank up PlotPoints and be prepared to wait a while.

ϕ[s_] := 2 + Cos[s]; ψ[s_] := Sin[s];

 cols = RGBColor /@ {"#A64942", "#FF7844", "#FFAB5E", "#23425F"};
    Table[{i ϕ[v] Cos[u], ϕ[v] Sin[u], ψ[v]} /. {u -> 
        ArcSin[yp/(2 + Cos[v])]}, {yp, 
      3 - y, -3, -3/8}, {i, {-1, 1}}], {v, 0, 2 π}, 
   Boxed -> False, Axes -> None, 
   PlotStyle -> 
      Blend[Reverse[cols[[;; 3]]], (y + 3/8 i)/6]], {i, 0, 15}], 
   PlotRange -> {{-3.5, 3.5}, {-3.5, 3.5}, {-1.1, 1.1}}, 
   ViewPoint -> {0, 0, 2}, ViewAngle -> π/6, PlotPoints -> 200, 
   ImageSize -> 540, Background -> cols[[4]]], {y, 0, 3/8}]]

I can drink tea and watch this all day.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract