Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- planets = Join[{"Sun"}, AstronomicalData["Planet"]];
- planets = Select[planets, # != "Earth" &];
- t0 = AbsoluteTime[{2012, 1, 1, 0, 0, 0}];
- t1 = AbsoluteTime[{2013, 1, 1, 0, 0, 0}];
- r = Norm[AstronomicalData["Uranus", "Position"]];
- n = {0, 0, 1};
- pos[p_, t_] := (AstronomicalData[p, {"Position", DateList[t]}])/r;
- pi[p_, t_] :=
- Module[{x = pos[p, t], u = n,
- v = (pos["Sun", t] - pos["Earth", t])\[Cross]n, X},
- v = v/Norm[v];
- X = {v.x, u.x}
- ];
- pi2[p_, t_] := Module[{X = pi[p, t]},
- If[Norm[X] == 0,
- X,
- (X/Norm[X]) VectorAngle[pos["Earth", t],
- pos[p, t]] (Norm[pos[p, t]]^0.3)/Pi
- ]
- ]
- Clear[planetimg];
- planetimg[p_] :=
- planetimg[p] = Module[{img = AstronomicalData[p, "Image"]},
- SetAlphaChannel[img,
- ImageApply[If[Norm[#] > 0.5, {1, 1, 1}, #] &, img]]
- ];
- frame[t_] :=
- Graphics[
- {Table[{White,
- Inset[Rotate[Style[Text[p], Large], Pi/2],
- pi2[p, t] + {0, 0.2}, {Center, Bottom}],
- Inset[planetimg[p], pi2[p, t], {Center, Center}, 0.2]}, {p,
- planets}
- ]
- ,
- White,
- Text[DateString[
- DateList[t], {"Day", " ", "MonthName", " ", "Year"}], {0, -0.1}]
- }
- , PlotRange -> {{-1.2, 1.2}, {-0.2, 1}}, Background -> Black];
- anim = Table[frame[t], {t, t0, t1, (t1 - t0)/60}];
- Export["planets.gif", anim]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement