TransWikia.com

Plot a wave on a surface

Mathematica Asked by Mikayel on December 29, 2020

Say I’m plotting a 3d-ring with

ParametricPlot3D[{Cos[t] (3 + Cos[u]), Sin[t] (3 + Cos[u]), 
  Sin[u]}, {t, 0, 2 Pi}, {u, 0, 2 Pi}, Boxed -> False, Axes -> False, 
 Mesh -> None]

I need to plot a wave, like a sin-function, which runs over the surface of the ring. Something like a mesh line, which is not straight, but oscillates?

Is it possible to plot?

enter image description here

2 Answers

Edit

You can draw a Sin like curve in the parametric domain,see f[t,u] as below.

f[t_, u_] := 2 u - 1 - Sin[15 t];
ContourPlot[f[t, u] == 0, {t, 0, 2 π}, {u, 0, 2 π}, 
 PlotPoints -> 80, FrameLabel -> {t, u}]

enter image description here

and then use the MeshFunctions to lift it to the surface.

ParametricPlot3D[{Cos[t] (3 + Cos[u]), Sin[t] (3 + Cos[u]), 
  Sin[u]}, {t, 0, 2 Pi}, {u, 0, 2 Pi}, Boxed -> False, Axes -> False, 
 MeshStyle -> Directive[Thick, Cyan], 
 MeshFunctions -> Function[{x, y, z, t, u}, f[t, u]], Mesh -> {{0}}, 
 PlotPoints -> 80]

enter image description here

Original

Like this?

f[x_, y_, k_] := 4 Cos[Sqrt[x^2 + y^2] - k]*Exp[-Sqrt[x^2 + y^2]/6];
Manipulate[
 ParametricPlot3D[{Cos[t] (3 + Cos[u]), Sin[t] (3 + Cos[u]), 
   Sin[u]}, {t, 0, 2 Pi}, {u, 0, 2 Pi}, Boxed -> False, Axes -> False,
   MeshStyle -> Directive[Thick, Cyan], 
  MeshFunctions -> Function[{x, y, u, v}, f[u, v, k]], Mesh -> 40, 
  PerformanceGoal -> "Quality"], {k, 0, 8/π, 1/(50 π)}]

Answered by cvgmt on December 29, 2020

Perhaps this?

Show[
 ParametricPlot3D[{Cos[t] (3 + Cos[u]), Sin[t] (3 + Cos[u]), Sin[u]},
  {t, 0, 2 Pi}, {u, 0, 2 Pi},
  Boxed -> False, Axes -> False, Mesh -> None],
 ParametricPlot3D[
  With[{t = v, u = 0.5 Sin[20 v]},  
    {Cos[t] (3 + Cos[u]), Sin[t] (3 + Cos[u]), Sin[u]}
   ],
  {v, 0, 2 Pi},
  PlotStyle -> Thick]
 ]

Answered by Michael E2 on December 29, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP