Advanced Question Converting ecliptic inclination to equatorial with matrix.

asbjos

tuanibrO
Addon Developer
Joined
Jun 22, 2011
Messages
698
Reaction score
269
Points
78
Location
This place called "home".
I'm developing an MFD which I want to display the equatorial inclination. I have gotten the inclination with the GetElements method.
Code:
Vessel->GetElements(RefPlanet, el, &prm);
Inc = el.i;
My problem now is to convert it from ecliptic to equatorial inclination. I searched the forum and found this post: http://www.orbiter-forum.com/showthread.php?p=363942&postcount=6. Now this method only works for Earth, and I want my MFD to be universal.

I then found this Wikipedia page: http://en.wikipedia.org/wiki/Celestial_coordinate_system#Equatorial_.E2.86.90.E2.86.92_ecliptical.
This shows me how to do it with a matrix. But the sad part is that I have no knowledge about how to calculate using matrices (if that is what it's called).

Could somebody show me how to do this conversion using C++ language or Orbiter API? If not, it would be nice to see how it's done on paper so that I can do the calculation in C++ later one step at the time.
Also, what calls should I use to get the ecliptic longitude and latitude (or what else that I need to get the variables for each planet)?
:idk:
 
The API allows you to directly get the orbital elements wrt the equatorial frame of the reference body.

API_Reference.pdf page 377

bool VESSEL::GetElements(OBJHANDLE hRef,ELEMENTS& el,ORBITPARAM ∗ prm = 0,double mjd_ref = 0,int frame =FRAME_ECL)const

Returns osculating elements and additional orbit parameters.
Returns the current osculating elements for the vessel. This version has an extended functionality: it allows to specify an arbitrary celestial body as reference object, an arbitrary reference time, and can return
elements either in the ecliptic or equatorial frame of reference.

You'd need to use
Code:
int frame =FRAME_EQ

Even if this solves your problem, knowing how to actually make the calculation would be cool, so any additional info from other members would be much appreciated.
:tiphat:
 
I'm sure there's someone else out there more qualified to respond to this than me, but just thought I'd post this.

- Based on my skim of the article: to get the coordinates (alpha and delta, or whatever) presumably all you need to do is inverse tan and sin for the respective equations.

- Possibly dumb question from a non astrophysicist: if the inclination is just the angle between two planes, and you have your inclination relative to the ecliptic plane, if you had the inclination of the ecliptic relative to the equatorial couldn't you just use the sum of the two angles?:shifty:
 
Here's how you convert a VECTOR3 to equatorial frame:
PHP:
VECTOR3 SpaceMathOrbiter::ToEquatorial( const VECTOR3 & in, const OBJHANDLE hRef ) const
{
    MATRIX3 rot;
    oapiGetPlanetObliquityMatrix(hRef, &rot);
    return tmul(rot, in);
}

Also, what calls should I use to get the ecliptic longitude and latitude (or what else that I need to get the variables for each planet)?
:idk:
I don't fully understand the question. Here's some example code how to get equatorial lat & lon. If you needed ecliptic, then I believe that you wouldn't convert the pos and vel ToEquatorial.
 
The API allows you to directly get the orbital elements wrt the equatorial frame of the reference body.

API_Reference.pdf page 377

You'd need to use
Code:
int frame =FRAME_EQ
Hah, I didn't see that. Thank you!

- Possibly dumb question from a non astrophysicist: if the inclination is just the angle between two planes, and you have your inclination relative to the ecliptic plane, if you had the inclination of the ecliptic relative to the equatorial couldn't you just use the sum of the two angles?:shifty:
I guess you cannot do this, as the planet moves around the star. On one time of the year on Earth you would need to add 23.44 degrees to your ecliptic inclination, but on the other side of the Sun half a year later, you would need to subtract 23.44 degrees from your inclination to make it equatorial.

I don't fully understand the question. Here's some example code how to get equatorial lat & lon. If you needed ecliptic, then I believe that you wouldn't convert the pos and vel ToEquatorial.
I referred to the alpha and beta in the Wikipedia equation, which were defined as ecliptic longitude and ecliptic latitude.


Thank you for your answers!
 
Back
Top