1
$\begingroup$

Here is my code here.

Please help me correct this.

How to make these 2 points Blue and Orange respectively?

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, Orange}, 
     Point[{{r1 Cos[w1 t], 
        r1 Sin[w1 t]}, {r1 Cos[w1 t] + r2 Cos[w2 t], 
        r1 Sin[w1 t] + r2 Sin[w2 t]}}]}],
  LineLegend[{ColorData[97]@1, Red, Blue, Orange},
   {"Earth Trajectory", "Moon Trajectory", "Earth", "Moon"},
   Joined -> {True, True, False, False}, 
   LegendMarkers -> {None, None, "Point", "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$
5
$\begingroup$

Use

Epilog -> {Black, AbsolutePointSize[5], 
  Point@Graphics`Mesh`FindIntersections[pp[[1]]], PointSize[Large], 
  Blue, Point[{r1 Cos[w1 t], r1 Sin[w1 t]}],
  Orange, Point[{r1 Cos[w1 t] + r2 Cos[w2 t], r1 Sin[w1 t] + r2 Sin[w2 t]}]}

or

Epilog -> {Black, AbsolutePointSize[5], 
  Point@Graphics`Mesh`FindIntersections[pp[[1]]], PointSize[Large], 
  Thread[{{Blue, Orange}, Point /@ {{r1 Cos[w1 t], r1 Sin[w1 t]},
       {r1 Cos[w1 t] + r2 Cos[w2 t], r1 Sin[w1 t] + r2 Sin[w2 t]}}}]}

to get

enter image description here

| improve this answer | |
$\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.