Coordinate conversions¶
Rotate a vector between frames¶
GetFrameRotationMatrix returns a 3×3 rotation matrix. Use it to rotate any vector expressed in one frame into another at a specific epoch.
For state vectors (position + velocity) use GetFrameStateRotationMatrix to get both R and dR/dt. They form the 6×6 state-transition matrix [[R, 0], [dR/dt, R]].
Transform a state vector directly¶
If you already have a StateVector, the simplest path is ConvertStateVectorToTheGivenFrame, which does the rotation and the velocity correction for you.
{
"stateVector": {
"centerOfMotion": "EARTH",
"epoch": { "dateTime": "2024-01-01T00:00:00", "kind": "UTC" },
"frame": "ICRF",
"position": { "x": 7000000, "y": 0, "z": 0 },
"velocity": { "x": 0, "y": 7500, "z": 0 }
},
"frame": "ITRF93"
}
Equatorial coordinates (RA / Dec)¶
For astronomical pointing, ConvertStateVectorToEquatorialCoordinates returns right ascension (rad), declination (rad), distance (m), and the epoch. The state vector is implicitly rotated into ICRF first.
Body-fixed Cartesian ↔ planetodetic¶
Working on the ground? Use ConvertPlanetodeticToCartesian and ConvertCartesianToPlanetodetic — both pick up the body's equatorial radius and flattening automatically.
Time-scale conversions¶
Same idea on the time axis. ConvertDateTime switches between UTC, TDB, TAI, TDT, GPS and Local. ConvertToJulianDate, ConvertToModifiedJulianDate, and ConvertToEphemerisTime are also available. See Time.