def pqw2ijk(pqw, inc, raan, argp): """Converts from perifocal to IJK. """ ijk = transform(pqw, -argp, 2) ijk = transform(ijk, -inc, 0) ijk = transform(ijk, -raan, 2) return ijk
def coe2rv(k, p, ecc, inc, raan, argp, nu): """Converts from classical orbital elements to vectors. Parameters ---------- k : float Standard gravitational parameter (km^3 / s^2). p : float Semi-latus rectum or parameter (km). ecc : float Eccentricity. inc : float Inclination (rad). omega : float Longitude of ascending node (rad). argp : float Argument of perigee (rad). nu : float True anomaly (rad). """ r_pqw, v_pqw = rv_pqw(k, p, ecc, nu) r_ijk = transform(r_pqw, -argp, 2) r_ijk = transform(r_ijk, -inc, 0) r_ijk = transform(r_ijk, -raan, 2) v_ijk = transform(v_pqw, -argp, 2) v_ijk = transform(v_ijk, -inc, 0) v_ijk = transform(v_ijk, -raan, 2) return r_ijk, v_ijk
def coe2rv(k, p, ecc, inc, raan, argp, nu): r"""Converts from classical orbital to state vectors. Classical orbital elements are converted into position and velocity vectors by `rv_pqw` algorithm. A rotation matrix is applied to position and velocity vectors to get them expressed in terms of an IJK basis. .. math:: \begin{align} \vec{r}_{IJK} &= [ROT3(-\Omega)][ROT1(-i)][ROT3(-\omega)]\vec{r}_{PQW} = \left [ \frac{IJK}{PQW} \right ]\vec{r}_{PQW}\\ \vec{v}_{IJK} &= [ROT3(-\Omega)][ROT1(-i)][ROT3(-\omega)]\vec{v}_{PQW} = \left [ \frac{IJK}{PQW} \right ]\vec{v}_{PQW}\\ \end{align} Previous rotations (3-1-3) can be expressed in terms of a single rotation matrix: .. math:: \left [ \frac{IJK}{PQW} \right ] .. math:: \begin{bmatrix} \cos(\Omega)\cos(\omega) - \sin(\Omega)\sin(\omega)\cos(i) & -\cos(\Omega)\sin(\omega) - \sin(\Omega)\cos(\omega)\cos(i) & \sin(\Omega)\sin(i)\\ \sin(\Omega)\cos(\omega) + \cos(\Omega)\sin(\omega)\cos(i) & -\sin(\Omega)\sin(\omega) + \cos(\Omega)\cos(\omega)\cos(i) & -\cos(\Omega)\sin(i)\\ \sin(\omega)\sin(i) & \cos(\omega)\sin(i) & \cos(i) \end{bmatrix} Parameters ---------- k : float Standard gravitational parameter (km^3 / s^2). p : float Semi-latus rectum or parameter (km). ecc : float Eccentricity. inc : float Inclination (rad). omega : float Longitude of ascending node (rad). argp : float Argument of perigee (rad). nu : float True anomaly (rad). Returns ------- r_ijk: np.array Position vector in basis ijk v_ijk: np.array Velocity vector in basis ijk """ r_pqw, v_pqw = rv_pqw(k, p, ecc, nu) r_ijk = transform(r_pqw, -argp, 2) r_ijk = transform(r_ijk, -inc, 0) r_ijk = transform(r_ijk, -raan, 2) v_ijk = transform(v_pqw, -argp, 2) v_ijk = transform(v_ijk, -inc, 0) v_ijk = transform(v_ijk, -raan, 2) return r_ijk, v_ijk