0
$\begingroup$

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

$\endgroup$

2 Answers 2

4
$\begingroup$

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]
 ]
$\endgroup$
3
$\begingroup$

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 π)}]
$\endgroup$
0

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.