;+ ; NAME: ; oc_t2x_rotmat ; PURPOSE: (one line) ; Return the matrix for rotating target coords to XYZ ; DESCRIPTION: ; Return the matrix for rotating target coords to XYZ ; CATEGORY: ; Occultations ; CALLING SEQUENCE: ; R = oc_t2x_rotmat(targ, et) ; INPUTS: ; targ = target (string or id) ; et = ephemeris time (TDB seconds after J2000) ; OPTIONAL INPUT PARAMETERS: ; none ; KEYWORD INPUT PARAMETERS: ; none ; KEYWORD OUTPUT PARAMETERS: ; none ; OUTPUTS: ; R - rotation matrix for rotating an vector xyz in target's ; coordinate system to XYZ ; xyz are defined in terms of the targets pole and central meridian ; unit vector is on the equator at zero longitude ; unit vector is on the equator at 90 deg longitude ; unit vector is toward the North pole, ; ; XYZ are the J2000 rectangular coordinates ; X = cos(ra_s) cos(dec_s) ; Y = sin(ra_s) cos(dec_s) ; Z = sin(dec_s) ; ; COMMON BLOCKS: ; None ; SIDE EFFECTS: ; RESTRICTIONS: ; None ; PROCEDURE: ; ; Call CSPICE_CIDFRM to get the frame name and ; CSPICE_PXFORM for the matrix ; ; USE: ; The matrix is defined so that ; XYZ_j2000 = R ## xyz_targ ; xyz_targ, XYZ_j2000 column vectors ; where XYZ_j2000 and xyz_targ are column vectors (Array[1,3]) and ## is the ; IDL operator for ordinary matrix multiplication (inner product). ; It is usually more convenient to use xyz_targ and XYZ_j2000 as row vectors ; (Array[3]). In this case we have ; XYZ_j2000 = transpose(R) # xyz_targ ; XYZ_j2000, xyz_targ row vectors ; ; MODIFICATION HISTORY: ; 2005 Dec 29 Leslie A Young SwRI ;- function oc_t2x_rotmat, targ, et if size(targ, /n_dim) ne 0 or size(et, /n_dim) ne 0 then begin print, 'oc_t2x_rotmat: targ and et must both be scalars' return, -1 end ; convert from string to long if targ is a string targid = naif_id(targ, found) if not found then begin print, 'oc_t2x_rotmat: ID for target ', targ, ' not found' return, -1 endif cspice_cidfrm, targid, frcode, frname, found if not found then begin print, 'oc_t2x_rotmat: frame for target ', targid, ' not found' return, -1 endif cspice_pxform, frname, 'J2000', et, r_t2x return, r_t2x end