Message Boards Message Boards

GROUPS:

[GIF] Left or Right? (Rotating Roman surface)

Posted 3 years ago
4722 Views
|
4 Replies
|
5 Total Likes
|

Rotating Roman surface

Left or Right?

A slightly unusual view of the Roman surface.

Source code:

DynamicModule[{cols},
 cols = RGBColor /@ {"#FFF4E1", "#E67A7A"};
 Manipulate[
  ParametricPlot3D[
   Evaluate@
    Table[{Cos[θ] Sin[θ] Sin[ϕ], Cos[θ] Sin[θ] Cos[ϕ], Cos[θ]^2 Cos[ϕ] Sin[ϕ]}, 
      {θ, 0, 2 π, π/50}], {ϕ, 0, 2 π}, PlotRange -> 1/2, 
   ViewPoint -> 5 {Cos[t], Sin[t], 0}, Boxed -> False, Axes -> False, 
   ImageSize -> 540, SphericalRegion -> True, Background -> cols[[2]],
    PlotStyle -> Directive[Thickness[.004], cols[[1]]]], {t, 0, π}]
 ]
4 Replies
Posted 3 years ago

Since you aren't dynamically changing cols in your Manipulate[] (which I'd say is really the only reason to use DynamicModule[]), simply injecting them with With[] suffices.

POSTED BY: J. M.
Answer

Nice. I think I switched from meshes to individually-plotted curves because the mesh was not playing very nicely with the surface I originally had in this. Of course, when I got rid of the surface altogether, I should have gone back to the mesh, since it's faster and conceptually simpler.

Incidentally, what's the reason for using With rather than DynamicModule?

Posted 3 years ago

My take:

With[{cols = RGBColor /@ {"#FFF4E1", "#E67A7A"}},
     Manipulate[ParametricPlot3D[{Cos[θ] Sin[θ] Sin[ϕ], Cos[θ] Sin[θ] Cos[ϕ], Cos[θ]^2 Cos[ϕ] Sin[ϕ]},
                                 {θ, 0, 2 π}, {ϕ, 0, 2 π}, Axes -> False, Background -> cols[[2]], Boxed -> False,
                                 ImageSize -> 540, Mesh -> 99, MeshFunctions -> {#4 &},
                                 MeshStyle -> Directive[Thickness[.004], cols[[1]]], PlotRange -> 1/2,
                                 PlotStyle -> None, SphericalRegion -> True, ViewPoint -> 5 {Cos[t], Sin[t], 0}],
                 {t, 0, π}]]

Increase PlotPoints as needed.

POSTED BY: J. M.
Answer

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!

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