Message Boards Message Boards

[GIF] Square Up (Trig surface animation)

Trig surface animation

Square Up

Just an animation of the graph of $f(x,y)=\frac{6}{5} \sin^3(\theta/2) \sin(6 \theta) \sin x \sin y$ as $\theta$ ranges from $0$ to $2\pi$.

Of course, originally this was just the surface with PlotStyle->None and with an appropriately-spaced mesh (which, as @J. M. has been pointing out to me in various threads, is much faster), but there doesn't seem to be a good way to get MeshStyle to color a single mesh line in different colors (something like ColorFunctions), so I had to build my own mesh with lines and color it with VertexColors.

Also, I'm experimenting with some different code formatting, so let me know if you have any strong opinions:

With[
 {
  n = 20,
  a = 1.2,
  k = 6,
  cols = RGBColor /@ {"#28C7FA", "#FF304F", "#002651"}
  },
 Manipulate[
  Graphics3D[
   {
    AbsoluteThickness[1.5],
    Table[
         Line[#[[i]], VertexColors -> (Blend[cols[[;; -2]], (# + a)/(2 a)] & /@ #[[i, ;; , 3]])],
         {i, Length[#]}] & /@ {#, Transpose[#]}
      &[Table[{2 ? (x - 1)/n, 2 ? (y - 1)/n, 
       a*Haversine[?]^(3/2) Sin[k ?] Sin[2 ? (x - 1)/n] Sin[2 ? (y - 1)/n]},
      {x, 1, n + 1}, {y, 1, n + 1}]
     ]
    },
   Boxed -> False,
   PlotRange -> {{-.5, 2 ? + .5}, {-.5, 2 ? + .5}, {-2.5, 2.5}},
   ImageSize -> 540,
   ViewPoint -> {2, 0, 1},
   SphericalRegion -> True,
   Background -> cols[[-1]]],
  {?, 0, 2 ?}]
 ]
2 Replies

enter image description here - another post of yours has been selected for the Staff Picks group, congratulations !

We are happy to see you at the top of the "Featured Contributor" board. Thank you for your wonderful contributions, and please keep them coming!

POSTED BY: EDITORIAL BOARD
Posted 8 years ago

Yes, it's a known weakness of Mesh that it doesn't take an associated ColorFunction, which is a pity for makers of fine artwork. ;)

A physically realistic variant would be to look at the surfaces corresponding to the so-called "Chladni plates" (see e.g. this Demonstration).

POSTED BY: J. M.
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract