subroutine kep2car ( kep, car, mu ) double precision kep(6), car(6), mu C C******************************************************************************* C C Copyright (C) 1993, California Institute of Technology. U.S. C Government Sponsorhip under NASA Contract NAS7-918 is C acknowledged. C C******************************************************************************* C C Input: Keplerian elements in km and degrees C Output: Cartesian elements in km and km/sec. C double precision p(3), q(3), w(3), COSRAAN, SINRAAN, & COSAOP, SINAOP, COSINCL, SININCL, U, THETA, & COSTHETA, SINTHETA, R, VCIRC, SemiParm double precision pi parameter ( pi=3.14159 26535 89793 23846) cosRAAN = cos(kep(4)*PI/180.0) sinRAAN = sin(kep(4)*PI/180.0) cosAOP = cos(kep(5)*PI/180.0) sinAOP = sin(kep(5)*PI/180.0) cosINCL = cos(kep(3)*PI/180.0) sinINCL = sin(kep(3)*PI/180.0) P(1) = cosRAAN * cosAOP - sinRAAN * sinAOP * cosINCL P(2) = sinRAAN * cosAOP + cosRAAN * sinAOP * cosINCL P(3) = sinAOP * sinINCL Q(1) = -cosRAAN * sinAOP - sinRAAN * cosAOP * cosINCL Q(2) = -sinRAAN * sinAOP + cosRAAN * cosAOP * cosINCL Q(3) = cosAOP * sinINCL W(1) = sinRAAN * sinINCL W(2) = -cosRAAN * sinINCL W(3) = cosINCL CALL ORB2U (KEP, U) THETA = U - KEP(5) cosTHETA = cos( THETA * PI/180.0 ) sinTHETA = sin( THETA * PI/180.0 ) SemiParm = kep(1) * ( 1 - KEP(2)*kep(2) ) R = SemiParm / ( 1 + kep(2)*cosTHETA ) VCIRC = SQRT ( MU / (SemiParm) ) do i=1,3 car(i) = r * COSTHETA * P(i) + r * SINTHETA * Q(i) car(i+3) = Vcirc * ( -SINTHETA * P(i) + & ( kep(2) + cosTheta ) * Q(i) ) end do return end C program driver C double precision CAR(6), KEP(6), MU C data KEP / 7714.43446628842718837, 0.00010252944063611, C & 66.04284092566848763, 30.31672498043705000, C & 89.87211868114119540, 220.04188763963342623 / C MU = 398600.436000 C C call kep2car ( KEP, CAR, MU ) C write(6,*) 'KEP = ', kep C write(6,*) 'CAR = ', car C end