Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- T = 2.59;
- r = 1.524;
- stars = Partition[
- Riffle[RandomReal[{-2, 2}, 20], RandomReal[{2.5, 3.5}, 20]], 2];
- Project[{ax_, ay_}, {bx_, by_}] :=
- Module[{\[Lambda] = (3 - ay)/(
- by - ay)}, {ax + \[Lambda] bx - \[Lambda] ax, 3}];
- mars[t_] := r {Sin[2 Pi t/T], Cos[2 Pi t/T]};
- earth[t_] := {Sin[2 Pi t], Cos[2 Pi t]};
- Manipulate[
- Show[Graphics[Join[
- { RGBColor[1, 0.2, 0], Disk[mars[t], 0.05],
- RGBColor[0, 0.6, 1],
- Disk[earth[t], 0.05],
- If[Abs[t] <= 0.38,
- Line[{earth[t], Project[earth[t], mars[t]] + {0, t}}],
- Opacity[1]],
- Blend[{Yellow, Orange}, 0.2],
- Disk[{0, 0}, 0.1], White, Point[stars]}
- ], PlotRange -> {{-2, 2}, {-2, 4}}],
- ParametricPlot[{Project[earth[t], mars[t]][[1]], t + 3}, {t, -0.38,
- 0.38}, Axes -> None, PlotStyle -> RGBColor[1, 0.2, 0]]
- , Background -> Black]
- , {t, -1, 1 }]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement