C+ C NAME: C smei_hdr_eph C PURPOSE: C Get direction to specified body in camera coordinate frame C CALLING SEQUENCE: logical function smei_hdr_eph(hdr,id,nbody,rx,ry,rz) C INPUTS: C hdr(*) double precision C SMEI frame header C id integer 0: geocentric direction, using JPL ephemeris C 1: geocentric direction, use USNO ephemeris (not implemented yet) C 2: topocentric direction, using JPL ephemeris C 3: topocentric direction, use USNO ephemeris (not implemented yet) C The topocentric direction takes the spacecraft location C into account. C nbody integer 0,..,10 C Any of the bodies used by the JPL ephemeris C OUTPUTS: C rx,ry,rz double precision C x,y,z components of a unit vector C in the UCSD camera coordinate frame. C CALLS: C smei_hdr_time, Time2jpl_eph, Time2smei_eph, smei_hdr_quaternion C quaternion_rotate_xyz C RESTRICTIONS: C It may be necessary to close the JPL ephemeris C with a call to jpl_close() C PROCEDURE: C (rx,ry,rz) is a vector on the unit sphere defining the C direction to the selected body. The components are defined C in the UCSD camera coordinate frame. C C Several angles can be derived from this. C The direction cosine angles follow by taking the arcsin: C tx = asind(rx) C ty = asind(ry) C The rotation angles (needed for the glare removal): C tx = asind( sind(tx)/cosd(ty) ) = asind( rx/cosd( asind(ry) ) C ty = asind( sind(ty)/cosd(tx) ) = asind( ry/cosd( asind(rx) ) C MODIFICATION HISTORY: C JAN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- double precision hdr(*) integer id integer nbody double precision rx double precision ry double precision rz integer tt(2) double precision rr(6) double precision ss(6) double precision dval double precision qq(4) logical Time2jpl_eph logical Time2smei_eph call smei_hdr_time(hdr,tt) ! Frame time ! Sometime the USNO asteroid ephemeris should be added here ! For now always assume the JPL ephemeris !if (mod(id,2) .eq. 0) then smei_hdr_eph = Time2jpl_eph(tt,nbody,3,rr,.FALSE.,.FALSE.) !else ! smei_hdr_eph = Time2usno_eph(tt,nbody,3,rr,.FALSE.,.FALSE.) !end if if (smei_hdr_eph .and. id/2 .eq. 1) then smei_hdr_eph = Time2smei_eph(tt,ss,.FALSE.) rr(1) = rr(1)-ss(1) rr(2) = rr(2)-ss(2) rr(3) = rr(3)-ss(3) end if if (smei_hdr_eph) then dval = dsqrt( rr(1)*rr(1)+rr(2)*rr(2)+rr(3)*rr(3) ) rx = rr(1)/dval ! Convert to unit vector ry = rr(2)/dval rz = rr(3)/dval ! Get quaternion to rotate from equatorial to UCSD camera frame call smei_hdr_quaternion(hdr,1,qq) call quaternion_rotate_xyz(qq,rx,ry,rz) else rx = 0.0d0 ry = 0.0d0 rz = 0.0d0 end if return end