Ecliptic to equatorial coordinates in lua

indy91

Addon Developer
Addon Developer
Joined
Oct 26, 2011
Messages
1,262
Reaction score
727
Points
128
For a lua script I want to calculate a state vector from an initial state vector and elapsed time. I know how to do this without perturbations. If I want to include disturbing acceleration due to the oblateness (J2) I need the equatorial state vector.
I think in C++ you can transform the coordinates by using oapiGetPlanetObliquityMatrix, but this doesn't work in lua. I tried many different variants e.g. with spherical equatorial coordinates (longitude, latitude and radius) but I never got accurate results or no velocity vector.

So my question is: How do you calculate the rotation matrix or is there another way to get the equatorial state vector (and thereby the orbital elements) in lua?
 
I tried a few more things and I still get a small difference between the calculated and actual equatorial coordinates (as seen in the scenario editor).

I noticed something strange in the Scenario Editor: Shouldn't be the difference between the geocentric ecliptic coordinate system and the fixed equatorial coordinate system only one rotation around the x-axis (earth's obliquity, around 23.4°)? The x values of the ecliptitc and equatorial coordinates are a little different. I think I am missing out on something.
 
Last edited:
Precession maybe?

(just guessing)
 
Precession maybe?

(just guessing)

:facepalm: And of course we have a nice document about that in the Technotes folder. I think that will help me, now I have something to read :)
 
Back
Top