3
$\begingroup$

I've tried to plot this . But It seemed useless in MeshFunctions

Manipulate[
 ParametricPlot[{{r1 Cos[w1 x], 
    r1 Sin[w1 x]}, {r1 Cos[w1 x] + r2 Cos[w2 x], 
    r1 Sin[w1 x] + r2 Sin[w2 x]}}, {x, 0, t}, 
  PlotRange -> 10 {{-1, 1}, {-1, 1}}, 
  PlotLegends -> {"Earth Trajectory", "Moon Trajectory"}, 
  MeshFunctions -> {{r1 Cos[w1 #] - r1 Cos[w1 #] + r2 Cos[w2 #], 
     r1 Sin[w1 #] - r1 Sin[w1 #] + r2 Sin[w2 #] &}}, 
  MeshStyle -> Directive[PointSize[0.05], Pink], 
  AxesLabel -> {"Time"}, PlotStyle -> {Automatic, Red}, 
  BaseStyle -> Thick, 
  Epilog -> {PointSize[Large], Blue, 
    Point[{r1 Cos[w1 t], r1 Sin[w1 t]}], PlotLegends -> {"Earth"}}],
 {{t, 1, "Time"}, 0.01, 10 Pi, 0.01},
 {{w1, 1, "Angular Velocity"}, 0.2, 5, 0.01},
 {{r1, 2, "Radius"}, 0.2, 10, 0.01},
 {{w2, 1, "Moon Angular Velocity"}, 0.2, 5, 0.01},
 {{r2, 2, " Moon Radius"}, 0.2, 10, 0.01}
]
$\endgroup$
4
$\begingroup$

You can use Graphics`Mesh`FindIntersections as follows:

Manipulate[pp = ParametricPlot[{{r1 Cos[Min[w1 x, 2 Pi]], r1 Sin[Min[w1 x, 2 Pi]]}, 
       {r1 Cos[w1 x] + r2 Cos[w2 x], r1 Sin[w1 x] + r2 Sin[w2 x]}}, {x, 0, t}, 
     PlotRange -> 10 {{-1, 1}, {-1, 1}}, AxesLabel -> {"Time"}, 
     PlotStyle -> {Automatic, Red}, BaseStyle -> Thick]; 
  Legended[Show[pp, Epilog -> {Black, AbsolutePointSize[5], 
      Point@Graphics`Mesh`FindIntersections[pp[[1]]], 
      PointSize[Large], Blue, Point[{r1 Cos[w1 t], r1 Sin[w1 t]}]}], 
   LineLegend[{ColorData[97]@1, Red, Blue},
     {"Earth Trajectory", "Moon Trajectory", "Earth"},
     Joined -> {True, True, False}, LegendMarkers -> {None, None, "Point"}]], 
  {pp, None},
  {{t, 1, "Time"}, 0.01, 10 Pi, 0.01},
  {{w1, 1, "Angular Velocity"}, 0.2, 5, 0.01},
  {{r1, 2, "Radius"}, 0.2, 10, 0.01}, 
  {{w2, 1, "Moon Angular Velocity"}, 0.2, 5, 0.01}, 
  {{r2, 2, " Moon Radius"}, 0.2, 10, 0.01}, 
  TrackedSymbols :> {t, w1, r1, w2, r2}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.