1
$\begingroup$

I am building an animated model of the solar system, where I would like to display the OrbitPaths of the planets along with their Positions at any one point in time. I would like to display the orbital paths as lines, just as they are given when inputting AstronomicalData["Earth", "OrbitPath"].

I'd like to display the positions as Spheres though. For some reason, even though I am combining the two graphical elements, only the spheres are displaying, and I cannot see the orbit lines at all. Would anyone be able to pinpoint what I am doing wrong in my code?

Animate[
 Show[
  Graphics3D[
   AstronomicalData[#, "OrbitPath"] & /@ AstronomicalData["Planet"]], 
  Graphics3D[
   Sphere[AstronomicalData[#, {"Position", DateList[x][[;; 3]]}] & /@ 
     AstronomicalData["Planet"], 5*10^10]]
  ], {x, 1, 10000000000}, AnimationRate -> 100000000
 ]

For the record, I tried putting the graphics primitives in a single Graphics3D and combining the spheres and lines into a single list of primitives, but that was throwing up too many problems so I figured this way would be more straightforward.

$\endgroup$
3
  • 1
    $\begingroup$ If you study the output of AstronomicalData["Venus", "OrbitPath"] and compare it to the output of AstronomicalData["Venus", "Position"] you'll see that the former doesn't provide the actual path coordinates but some kind of scaled version with numbers differing orders of magnitude from the latter ones. $\endgroup$ Apr 13, 2014 at 20:54
  • $\begingroup$ Thank you, @SjoerdC.deVries. I didn't realise that. Do you have a quick solution for how to scale them up to the position coordinate system? $\endgroup$
    – Aron
    Apr 13, 2014 at 20:59
  • $\begingroup$ It looks like the scaling is in astronomical units, so a multiplication by 149597870700 should do the trick. $\endgroup$ Apr 13, 2014 at 21:00

1 Answer 1

4
$\begingroup$

The orbit path is given in astronomical units whereas the position is given in meters, so you have to scale:

UnitConvert[Quantity[1, "AstronomicalUnit"], "m"]
(* Quantity[149597870700, "Meters"] *)

Animate[
 Graphics3D[
  {
   (AstronomicalData[#, "OrbitPath"] /.Line[a__] :> Line[149597870700 a]) & /@ 
          AstronomicalData["Planet"], 
   Sphere[AstronomicalData[#, {"Position", DateList[x][[;; 3]]}] & /@ 
     AstronomicalData["Planet"], 5*10^10]
   }
  ], {x, 1, 10000000000}, AnimationRate -> 100000000]

Mathematica graphics

$\endgroup$
3
  • $\begingroup$ I keep getting $Aborted when running the code. V 9.01 on windows 7.!Mathematica graphics restarted kernel few times. did not make difference. May be it is internet issue reading the data from WRI server $\endgroup$
    – Nasser
    Apr 13, 2014 at 21:20
  • 1
    $\begingroup$ @nasser Just start some AstronomicalData stuff on their own, like AstronomicalData["Venus", "OrbitPath"] to load the Paclet data and only then evaluate the Animation $\endgroup$ Apr 13, 2014 at 21:42
  • $\begingroup$ Perfect, @SjoerdC.deVries. This is precisely the answer I was looking for. Thank you. For me it also aborts a few times before running properly, but it looks like this might just be the sheer quantity of data it is calling up from AstronomicalData? $\endgroup$
    – Aron
    Apr 14, 2014 at 1:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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