Functions

sc_coord.h File Reference

Coordinate transformation functions. More...

Functions

ml_matrix az_el_range_range_rate_to_rv (const ml_matrix &q_radar_to_hills, double az, double el, double range, double range_dot)
 Converts az, el, range and range rate to exact r and approximate v.
ml_matrix q_from_u (const ml_matrix &u_catalog, const ml_matrix &u_meas)
 Returns a quaternion given at least 3 matching vectors.
double q_to_angle (const ml_matrix &quaternion)
 Returns value of the angle from the quaternion in radians.
ml_matrix q_to_vec (const ml_matrix &quaternion)
 Returns the value of the vector from quaternion.
ml_matrix au_to_q (double angle, double unit_vec[3])
 Compute quaternion from angle and unit vector, array format.
ml_matrix au_to_q (double angle, const ml_matrix &unit_vec)
 Compute quaternion from angle and unit vector, matrix format.
double q_to_au (const ml_matrix &quaternion, ml_matrix &unit_vec)
 Compute angle and unit vector from quaternion.
ml_matrix eul_to_mat (const ml_matrix &euler)
 Convert 3-2-1 Euler angle sequence to a matrix that transforms in the direction of the rotation.
ml_matrix eul_to_q (const ml_matrix &euler)
 Convert 3-2-1 Euler angle sequence to a quaternion that transforms in the direction of the rotation.
ml_matrix delta_eul_to_q (const ml_matrix &q, const ml_matrix &euler)
 Apply a 3-2-1 Euler angle sequence to a quaternion that transforms in the direction of the rotation.
ml_matrix rot_mat_x (const double &a)
 Generate a rotation matrix for angular rotation about the x axis.
ml_matrix rot_mat_y (const double &a)
 Generate a rotation matrix for angular rotation about the y axis.
ml_matrix rot_mat_z (const double &a)
 Generate a rotation matrix for angular rotation about the z axis.
ml_matrix mat_to_q (const ml_matrix &mat)
 Convert a matrix to a quaternion.
ml_matrix mat_to_eul (const ml_matrix &mat, const ml_matrix &euler)
 Convert a matrix to an Euler angle sequence.
ml_matrix u_to_q (const ml_matrix &vec1, const ml_matrix &vec2)
 Computes the quaternion which aligns one vector with a second.
ml_matrix perpendicular (const ml_matrix &vec)
 Computes the perpendicular vector.
ml_matrix q_error (const ml_matrix &q_ref, const ml_matrix &q_meas)
 Finds the small error between two quaternions and converts them into an angle vector.
ml_matrix qb_to_i_dot (const ml_matrix &quaternion, const ml_matrix &w)
 Calculates the derivative of the body to inertial quaternion.
ml_matrix qi_to_b_dot (const ml_matrix &quat, const ml_matrix &w)
 Calculates the derivative of the inertial to body quaternion.
ml_matrix qeb_re_ub_to_az_el (const ml_matrix &qEB, const ml_matrix &rE, const ml_matrix &vB)
 Calculate azimuth & elevation angle from ECI to body quaternion, position, and boresight vector.
ml_matrix mat_eci_to_lvlh (const ml_matrix &pos, const ml_matrix &vel)
 Generate the matrix that transforms from ECI to LVLH coordinates.
ml_matrix q_eci_to_lvlh (const ml_matrix &pos, const ml_matrix &vel)
 Generate the quaternion that transforms from ECI to LVLH coordinates.
ml_matrix mat_eci_to_hills (const ml_matrix &r, const ml_matrix &v)
 Generate the matrix that transforms from ECI to Hills coordinates.
ml_matrix q_eci_to_hills (const ml_matrix &r, const ml_matrix &v)
 Generate the quaternion that transforms from ECI to Hills coordinates.
ml_matrix eci_to_hills (const ml_matrix &x0, const ml_matrix &x1)
 Transform from two ECI states to one relative state in Hills-frame.
ml_matrix hills_to_eci (const ml_matrix &x0, const ml_matrix &xH)
 Transform from a relative state in Hills-frame to an absolute ECI state.
ml_matrix q_to_ra_dec (const ml_matrix &quaternion, const ml_matrix &uu)
 Compute right ascension and declination from a quaterion.
ml_matrix u_to_ra_dec (const ml_matrix &unit_vec)
 Computes right ascension and declination from a unit vector.
ml_matrix u_to_ra_dec (const ml_matrix &unit_vec, bool normalize)
 Computes right ascension and declination from a unit vector and normalizes the result.
ml_matrix ra_dec_to_q (const ml_matrix &uu, double ra, double dec)
 Compute a quaternion from right ascension and declination.
ml_matrix ra_dec_to_u (double ra, double dec)
 Calculate a unit vector from right ascension and declination.
ml_matrix ra_dec_to_u (const ml_matrix &ra, const ml_matrix &dec)
 Calculate a unit vector from right ascension and declination.
ml_matrix az_el_to_q (ml_matrix az, ml_matrix el)
 Compute a quaternion from azimuth and elevation.
ml_matrix az_el_to_q (double az, double el)
 Compute a quaternion from azimuth and elevation.
ml_matrix qslerp (const ml_matrix &quat1, const ml_matrix &quat2, double t)
 Interpolates between two quaternions.
ml_matrix lat_lon_alt_to_pos (double lat, double lon, double h, double f=FLATTENING_FACTOR, double a=RADIUS_EARTH)
 Compute EF position vector from latitude, longitude, and altitude.
ml_matrix lat_lon_to_pos (double lat, double lon, double f, double a, bool is_geodetic)
 Converts latitude and longitude to r for an ellipsoidal planet.
ml_matrix lat_lon_to_pos (double lat, double lon, double f=FLATTENING_FACTOR, double a=RADIUS_EARTH, int type=0)
 Converts latitude and longitude to r for an ellipsoidal planet.
ml_matrix pos_to_lat_lon_alt (const ml_matrix &efPos, double f=FLATTENING_FACTOR, double a=RADIUS_EARTH, double tolerance=1.0e-6)
 Compute latitude, longitude, and altitude from EF position vector.
void cart_to_sph (const ml_matrix &x, const ml_matrix &y, const ml_matrix &z, ml_matrix &r, ml_matrix &theta, ml_matrix &phi)
 Converts cartesian coordinates to spherical.
ml_matrix cart_to_sph (const ml_matrix &x)
 Converts cartesian coordinates to spherical. Stacked form.
void sph_to_cart (const ml_matrix &r, const ml_matrix &theta, const ml_matrix &phi, ml_matrix &x, ml_matrix &y, ml_matrix &z)
 Convert spherical coordinates to cartesian.
ml_matrix RPhiTheta2Cart (const ml_matrix &r)
 Computes the transformation matrix from an r, phi, theta frame to cartesian.
ml_matrix CameraToECI (double az, double el, double tt, const ml_matrix &qECIToBody, const ml_matrix &mBaseToBody)
 Computes the transformation matrix from a camera frame with 3 rotations to the body frame.
ml_matrix eci_to_ned (const ml_matrix &r, int opt, double f=FLATTENING_FACTOR)
 Computes the transformation matrix or quaternion from a eciframe to the North East Down (NED) frame.
ml_matrix u_to_az_el (const ml_matrix &u)
 Computes the azimuth and elevation of a unit vector.
ml_matrix az_el_to_u (double az, double el)
 Computes u from azimuth and elevation of a unit vector.
ml_matrix az_el_to_u (const ml_matrix &az, const ml_matrix &el)
 Compute a unit vector from azimuth and elevation.
ml_matrix q_from_dq (const ml_matrix &q, const ml_matrix &dX)
 Computes q as the product of q and a delta quaternion.
ml_matrix dq_from_dX (const ml_matrix &dX)
 Delta quaternion from a 3 vector.
ml_matrix r_lvlh_to_eci (const ml_matrix &r_eci, const ml_matrix &v_eci, const ml_matrix &r)
 LVLH position to ECI.
ml_matrix v_lvlh_to_eci (const ml_matrix &r_eci, const ml_matrix &v_eci, const ml_matrix &v)
 ECI position to LVLH.
ml_matrix r_eci_to_lvlh (const ml_matrix &r_eci, const ml_matrix &v_eci, const ml_matrix &r)
 LVLH position to ECI.
ml_matrix v_eci_to_lvlh (const ml_matrix &r_eci, const ml_matrix &v_eci, const ml_matrix &v)
 ECI position to LVLH.
ml_matrix x_lvlh_to_eci (const ml_matrix &r_eci, const ml_matrix &v_eci, const ml_matrix &x)
 LVLH state to ECI.
ml_matrix x_eci_to_lvlh (const ml_matrix &r_eci, const ml_matrix &v_eci, const ml_matrix &x)
 ECI state to LVLH.
ml_matrix x_lvlh_to_eci (const ml_matrix &x_eci, const ml_matrix &x)
 ECI state to LVLH.
ml_matrix x_eci_to_lvlh (const ml_matrix &x_eci, const ml_matrix &x)
 ECI state to LVLH.
ml_matrix LLAToECEF (const ml_matrix &lla, double rP=RADIUS_EARTH)
 Compute ECEF position from latitude, longitude, altitude.
ml_matrix small_angles_to_q (const ml_matrix &angle)
 Convert small angles to a quaternion.
ml_matrix spice_to_3_by_3 (const ml_matrix &m, int k=1)
 Convert SPICE rotation matrix to 3x3.

Detailed Description


Function Documentation

ml_matrix az_el_range_range_rate_to_rv ( const ml_matrix &  q_radar_to_hills,
double  az,
double  el,
double  range,
double  range_dot 
)
Parameters:
azAzimuth
elElevation
rangeRange
range_dotRange rate
Returns:
state [r;v]
ml_matrix q_from_u ( const ml_matrix &  u_catalog,
const ml_matrix &  u_meas 
)
Parameters:
u_catalogA 3xn matrix of catalog unit vectors
u_measA 3xn matrix of measured unit vectors
Returns:
The quaternion.
double q_to_angle ( const ml_matrix &  quaternion )
Parameters:
quaternionThe quaternion.
Returns:
The angle from the quaternion in radians.

References PI, and TWO_PI.

ml_matrix q_to_vec ( const ml_matrix &  quaternion )
Parameters:
quaternionThe quaternion.
Returns:
The vector from the quaternion.
ml_matrix au_to_q ( double  angle,
double  unit_vec[3] 
)
Parameters:
angle
unit_vec
Returns:
The quaternion computed from the provided angle and unit vector.
ml_matrix au_to_q ( double  angle,
const ml_matrix &  unit_vec 
)
Parameters:
angle
unit_vec
Returns:
The quaternion computed from the provided angle and unit vector.
double q_to_au ( const ml_matrix &  quaternion,
ml_matrix &  unit_vec 
)
Parameters:
quaternionThe quaternion.
unit_vecThe unit vector will be returned in this matrix.
Returns:
The angle computed from the quaternion, measured in radians.
ml_matrix eul_to_mat ( const ml_matrix &  euler )
Parameters:
euler(3,1) The Euler angle sequence to be converted.
Returns:
The matrix which transforms in the direction of the rotation.
ml_matrix delta_eul_to_q ( const ml_matrix &  q,
const ml_matrix &  euler 
)

Apply a 3-2-1 Euler angle sequence to a quaternion that transforms in the direction of the rotation.

Parameters:
euler(3,1) The Euler angle sequence to be converted.
q(4,1) The original quaternion.
Returns:
The matrix which transforms in the direction of the rotation.
ml_matrix rot_mat_x ( const double &  a )

Generate a rotation matrix for angular rotation about the x axis.

Parameters:
aAngle of rotation (rad)
Returns:
The rotation matrix.
ml_matrix rot_mat_y ( const double &  a )

Generate a rotation matrix for angular rotation about the y axis.

Parameters:
aAngle of rotation (rad)
Returns:
The rotation matrix.
ml_matrix rot_mat_z ( const double &  a )

Generate a rotation matrix for angular rotation about the z axis.

Parameters:
aAngle of rotation (rad)
Returns:
The rotation matrix.
ml_matrix mat_to_q ( const ml_matrix &  mat )

Convert a matrix to a quaternion.

Wrapper for the MatrixLib function q_from_mat.

Parameters:
mat(3,3) The matrix to be converted.
Returns:
The quaternion generated from the provided matrix.
ml_matrix mat_to_eul ( const ml_matrix &  mat,
const ml_matrix &  euler 
)

Wrapper for the MatrixLib function q_mat_to_eul.

Parameters:
mat(3,3)
euler(3,1)
Returns:
Returns the Euler angle sequence generated from the provided matrix.
ml_matrix u_to_q ( const ml_matrix &  vec1,
const ml_matrix &  vec2 
)

Computes the quaternion which aligns one vector with a second.

This is not a unique solution.

Wrapper for the MatrixLib function q_from_u.

Parameters:
vec1(3,1) Starting vector.
vec2(3,1) Ending vector.
Returns:
Quaternion which rotates vec1 into vec2
ml_matrix perpendicular ( const ml_matrix &  vec )

Wrapper for the MatrixLib function q_perpendicular.

Parameters:
vec(3,1) The vector.
Returns:
Returns the perpendicular to the given vector.
ml_matrix q_error ( const ml_matrix &  q_ref,
const ml_matrix &  q_meas 
)

This routine gives the correct sign when both vectors transform from frame a to frame b and frame b is the body frame. If the convention is reversed you must reverse the sign.

Parameters:
q_ref(4,1) Reference quaternion.
q_meas(4,1) Measured quaternion.
Returns:
(3,1) Vector of small angular errors.
ml_matrix qb_to_i_dot ( const ml_matrix &  quaternion,
const ml_matrix &  w 
)

Calculates the derivative of the body to inertial quaternion.

Parameters:
quaternion(4,1) The quaternion, should be a column vector
w(3,1) The anglular velocity, a 3 element column vector
Returns:
(4,1) Derivative of the body to inertial quaternion.
ml_matrix qi_to_b_dot ( const ml_matrix &  quat,
const ml_matrix &  w 
)

Calculates the derivative of the inertial to body quaternion.

Parameters:
quat(4,1) The quaternion, should be a column vector.
w(3,1) The angular rate, a 3 element column vector.
Returns:
(4,1) Derivative of the inertial to body quaternion.
ml_matrix qeb_re_ub_to_az_el ( const ml_matrix &  qEB,
const ml_matrix &  rE,
const ml_matrix &  vB 
)

Calculate azimuth & elevation angle from ECI to body quaternion, position, and boresight vector.

Azimuth angle is measured clockwise from north to the projection of the boresight vector onto the east-north plane. Elevation angle is the "angle off nadir", the angular distance between the nadir vector and the boresight vector. Adapted by KenW from Joe Mueller's QEB_RE_UB_to_AzEl.m matlab code in /Contracts/NavyReconfigure/Matlab

Parameters:
qEB(4,1) ECI to spacecraft body coordinate frame quaternion
rE(3,1) ECI position of spacecraft
vB(3,1) boresight vector defined in body frame
Returns:
(2,1) matrix containing azimuth angle in (1,1) and elevation angle in (2,1)
ml_matrix mat_eci_to_lvlh ( const ml_matrix &  pos,
const ml_matrix &  vel 
)

For LVLH coordinates; z is in the -r direction y is in the - rxv direction x completes the set

Parameters:
pos(3,1) Position vectors
vel(3,1) Velocity vectors
Returns:
(4,n) The quaternions that transform from ECI to LVLH coordinates.
ml_matrix q_eci_to_lvlh ( const ml_matrix &  pos,
const ml_matrix &  vel 
)
Parameters:
pos(3,1) Position vector
vel(3,1) Velocity vector
Returns:
(4,n) The quaternions that transform from ECI to LVLH coordinates.
ml_matrix mat_eci_to_hills ( const ml_matrix &  r,
const ml_matrix &  v 
)

For Hills coordinates; x is in the + r direction z is in the + rxv direction y completes the set (aligned with velocity for circular orbits)

Parameters:
r(3,1) Position vector
v(3,1) Velocity vector
Returns:
q (4,1) Quaternion
ml_matrix q_eci_to_hills ( const ml_matrix &  r,
const ml_matrix &  v 
)
Parameters:
r(3,1) Position vector
v(3,1) Velocity vector
Returns:
q (4,1) Quaternion
ml_matrix eci_to_hills ( const ml_matrix &  x0,
const ml_matrix &  x1 
)
Parameters:
x0(6,1) ECI position and velocity of reference orbit
x1(6,1) ECI position and velocity of secondary orbit
Returns:
xH (6,1) Relative position and velocity in Hills-frame
ml_matrix hills_to_eci ( const ml_matrix &  x0,
const ml_matrix &  xH 
)
Parameters:
x0(6,1) ECI position and velocity of reference orbit
xH(6,1) Relative position and velocity in Hills-frame
Returns:
x1 (6,1) ECI position and velocity of secondary orbit
ml_matrix q_to_ra_dec ( const ml_matrix &  quaternion,
const ml_matrix &  uu 
)

Compute right ascension and declination from a quaterion.

Parameters:
quaternion(4,1) The quaternion (inertial to body).
uu(3,1) unit vector in the body frame.
Returns:
The right ascension and declination.
ml_matrix u_to_ra_dec ( const ml_matrix &  unit_vec )

Computes right ascension and declination from a unit vector.

Parameters:
unit_vec(3,n) Unit vector(s)
Returns:
rADec (2,n) stacked vector(s) of right ascension (top) and declination (bot)
ml_matrix u_to_ra_dec ( const ml_matrix &  unit_vec,
bool  normalize 
)

Computes right ascension and declination from a unit vector and normalizes the result.

Parameters:
unit_vec(3,n) Unit vector(s)
normalizeFlag indicating whether the return vector should be normalized.
Returns:
rADec (2,n) stacked vector(s) of right ascension (top) and declination (bot)

References TWO_PI.

ml_matrix ra_dec_to_q ( const ml_matrix &  uu,
double  ra,
double  dec 
)

If right ascension and declination are defined in frame a, and u is fixed in frame b, q transforms from frame a to b such that u lies along the vector determined by (rA,dec) in frame a.

Parameters:
uu(3,1) unit vector
ra(1) Right ascension [rad]
dec(1) Declination [rad]
Returns:
(4,1) Quaternion
ml_matrix ra_dec_to_u ( double  ra,
double  dec 
)
Parameters:
ra(1) Right ascension [rad]
dec(1) Declination [rad]
Returns:
A unit vector(3,1) computed from the provided right ascension and declination.
ml_matrix ra_dec_to_u ( const ml_matrix &  ra,
const ml_matrix &  dec 
)
Parameters:
ra(1,n) Right ascension [rad]
dec(1,n) Declination [rad]
Returns:
A unit vector computed from the provided right ascension and declination.
ml_matrix az_el_to_q ( ml_matrix  az,
ml_matrix  el 
)

Compute a quaternion from azimuth and elevation.

Parameters:
azIs the azimuth (angle about +z from +x)
elis the elevation (angle about +y from +x)
Returns:
(4,n) The quaternion from base to rotated frame.
ml_matrix az_el_to_q ( double  az,
double  el 
)

Compute a quaternion from azimuth and elevation.

Parameters:
azIs the azimuth (angle about +z from +x)
elis the elevation (angle about +y from +x)
Returns:
(4,1) The quaternion from base to rotated frame.
ml_matrix qslerp ( const ml_matrix &  quat1,
const ml_matrix &  quat2,
double  t 
)
Parameters:
quat1(4,1)
quat2(4,1)
t(1) between 0 to 1
Returns:
(4,1) Interpolated quaternion
ml_matrix lat_lon_alt_to_pos ( double  lat,
double  lon,
double  h,
double  f,
double  a 
)
Parameters:
latLatitude in radians.
lonLongitude in radians.
hDistance above the subsatellite point.
fFlattening factor
aEquatorial radius
Returns:
(3,1) The EF position vector.
ml_matrix lat_lon_to_pos ( double  lat,
double  lon,
double  f,
double  a,
bool  is_geodetic 
)
Parameters:
latLatitude in radians.
lonLongitude in radians.
fFlattening factor
aEquatorial radius
is_geodetictrue for geodetic
Returns:
(3,1) The EF position vector.
ml_matrix lat_lon_to_pos ( double  lat,
double  lon,
double  f,
double  a,
int  type 
)
Parameters:
latLatitude in radians.
lonLongitude in radians.
fFlattening factor
aEquatorial radius
type0 for Geodetic
Returns:
The EF position vector.
ml_matrix pos_to_lat_lon_alt ( const ml_matrix &  efPos,
double  f,
double  a,
double  tolerance 
)
Parameters:
efPosECEF position (km)
fFlattening factor
aEquatorial radius
toleranceTolerance for the iteration
Returns:
(3,1) lat (radians), lon (radians), altitude (km)

References PI.

void cart_to_sph ( const ml_matrix &  x,
const ml_matrix &  y,
const ml_matrix &  z,
ml_matrix &  r,
ml_matrix &  theta,
ml_matrix &  phi 
)

Individual vector form.

Parameters:
x
y
z
r
theta
phi
ml_matrix cart_to_sph ( const ml_matrix &  x )

Converts cartesian coordinates to spherical. Stacked form.

Stacked matrix form.

Parameters:
xPosition state [x;y;z]
Returns:
r New coordinates [r;theta;phi]
void sph_to_cart ( const ml_matrix &  r,
const ml_matrix &  theta,
const ml_matrix &  phi,
ml_matrix &  x,
ml_matrix &  y,
ml_matrix &  z 
)

Convert spherical coordinates to cartesian.

Individual vector form.

Parameters:
r
theta
phi
x
y
z
ml_matrix RPhiTheta2Cart ( const ml_matrix &  r )

Computes the transformation matrix from an r, phi, theta frame to cartesian.

In an RPT frame, r is the radial direction, phi is 'east', and theta is in the direction of co-elevation. When theta is zero the r vector is in the xy-plane.

Parameters:
rPosition vector
Returns:
cRPT2Cart Transformation matrix
ml_matrix CameraToECI ( double  az,
double  el,
double  tt,
const ml_matrix &  qECIToBody,
const ml_matrix &  mBaseToBody 
)

Computes the transformation matrix from a camera frame with 3 rotations to the body frame.

Parameters:
azAzimuth (rad)
elElevation (rad)
ttTurntable angle (rad)
qECIToBodyQuaternion from ECI to Body
mBaseToBodyTransformation matrix from Camera base to body
Returns:
mCameraToECI Transformation matrix
ml_matrix eci_to_ned ( const ml_matrix &  r,
int  opt,
double  f 
)

Computes the transformation matrix or quaternion from a eciframe to the North East Down (NED) frame.

Reference: Stevens, B.L., Lewis, F.L. , Aircraft Control and Simulation, John Wiley & Sons, 1992, p. 36.

Parameters:
rECI position vector (km)
opt0 output quaternion 1 output matrix (rad)
fFlattening factor
Returns:
qECIToNED or mECIToNED Transformation quaternion or matrix
ml_matrix u_to_az_el ( const ml_matrix &  u )

Computes the azimuth and elevation of a unit vector.

Parameters:
uUnit vector
Returns:
[az;el]
ml_matrix az_el_to_u ( double  az,
double  el 
)

Computes u from azimuth and elevation of a unit vector.

Parameters:
azAzimuth
elElevation
Returns:
Unit vector
ml_matrix az_el_to_u ( const ml_matrix &  az,
const ml_matrix &  el 
)

Compute a unit vector from azimuth and elevation.

Parameters:
azis the azimuth (angle about +z from +x)
elis the elevation (angle about +y from +x)
Returns:
The unit vector.
ml_matrix q_from_dq ( const ml_matrix &  q,
const ml_matrix &  dX 
)

Computes q as the product of q and a delta quaternion.

Parameters:
qQuaternion
dXDelta quaternion
Returns:
Quaternion
ml_matrix dq_from_dX ( const ml_matrix &  dX )

Delta quaternion from a 3 vector.

Parameters:
dXDelta quaternion
Returns:
Quaternion
ml_matrix r_lvlh_to_eci ( const ml_matrix &  r_eci,
const ml_matrix &  v_eci,
const ml_matrix &  r 
)

LVLH position to ECI.

Parameters:
r_eciPosition vector of reference center in the ECI frame
v_eciVelocity vector of reference center in the ECI frame
rPosition vector in lvlh frame
Returns:
Position vector in the eci frame
ml_matrix v_lvlh_to_eci ( const ml_matrix &  r_eci,
const ml_matrix &  v_eci,
const ml_matrix &  v 
)

ECI position to LVLH.

Parameters:
r_eciPosition vector of reference center in the ECI frame
v_eciVelocity vector of reference center in the ECI frame
vPosition vector in lvlh frame
Returns:
Position vector in the eci frame
ml_matrix r_eci_to_lvlh ( const ml_matrix &  r_eci,
const ml_matrix &  v_eci,
const ml_matrix &  r 
)

LVLH position to ECI.

Parameters:
r_eciPosition vector of reference center in the ECI frame
v_eciVelocity vector of reference center in the ECI frame
rPosition vector in eci frame
Returns:
Position vector in the lvlh frame
ml_matrix v_eci_to_lvlh ( const ml_matrix &  r_eci,
const ml_matrix &  v_eci,
const ml_matrix &  v 
)

ECI position to LVLH.

Parameters:
r_eciPosition vector of reference center in the ECI frame
v_eciVelocity vector of reference center in the ECI frame
vPosition vector in eci frame
Returns:
Position vector in the lvlh frame
ml_matrix x_lvlh_to_eci ( const ml_matrix &  r_eci,
const ml_matrix &  v_eci,
const ml_matrix &  x 
)

LVLH state to ECI.

Parameters:
r_eciPosition vector of reference center in the ECI frame
v_eciVelocity vector of reference center in the ECI frame
x[r;v] in lvlh frame
Returns:
Position vector in the eci frame
ml_matrix x_eci_to_lvlh ( const ml_matrix &  r_eci,
const ml_matrix &  v_eci,
const ml_matrix &  x 
)

ECI state to LVLH.

Parameters:
r_eciPosition vector of reference center in the ECI frame
v_eciVelocity vector of reference center in the ECI frame
x[r;v] in eci frame
Returns:
Position vector in the eci frame
ml_matrix x_lvlh_to_eci ( const ml_matrix &  x_eci,
const ml_matrix &  x 
)

ECI state to LVLH.

Parameters:
x_eciVelocity vector of reference center in the ECI frame
x[r;v] in lvlh frame
Returns:
Position vector in the eci frame
ml_matrix x_eci_to_lvlh ( const ml_matrix &  x_eci,
const ml_matrix &  x 
)

ECI state to LVLH.

Parameters:
x_eciState vector of reference center in the ECI frame [r;v]
x[r;v] in eci frame
Returns:
State in the eci frame
ml_matrix LLAToECEF ( const ml_matrix &  lla,
double  rP 
)

Compute ECEF position from latitude, longitude, altitude.

Assumes a spherical planet. Can handle an array of positions.

Parameters:
lla(3xn) Latitude [rad], longitude [rad], altitude [km]
rPRadius of planet (for Earth: 6378.14) [km]
Returns:
ECEF position vector [km]
ml_matrix small_angles_to_q ( const ml_matrix &  angle )
Parameters:
angleAngle vector
Returns:
Equivalent quaternion
ml_matrix spice_to_3_by_3 ( const ml_matrix &  m,
int  k 
)

Convert SPICE rotation matrix to 3x3.

Parameters:
mSPICE 9-by-1 rotation matrix (column major)
kColumn
Returns:
3-by-3 matrix Planet fixed to ECI