Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
1  
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. –  Sjoerd C. de Vries Apr 13 at 20:54
    
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? –  Aron Apr 13 at 20:59
    
It looks like the scaling is in astronomical units, so a multiplication by 149597870700 should do the trick. –  Sjoerd C. de Vries Apr 13 at 21:00
add comment

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer
    
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 –  Nasser Apr 13 at 21:20
1  
@nasser Just start some AstronomicalData stuff on their own, like AstronomicalData["Venus", "OrbitPath"] to load the Paclet data and only then evaluate the Animation –  Sjoerd C. de Vries Apr 13 at 21:42
    
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? –  Aron Apr 14 at 1:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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