Orbital elements: Difference between revisions
Content added Content deleted
m (→version 2: simplified the REXX code by eliding the need to use a slash separator for vectors, other improvements.) |
m (→version 2: moved subroutines/functions, added whitespace.) |
||
Line 940: | Line 940: | ||
<lang rexx>/*REXX pgm converts orbital elements ──► orbital state vectors (angles are in radians).*/ |
<lang rexx>/*REXX pgm converts orbital elements ──► orbital state vectors (angles are in radians).*/ |
||
numeric digits length(pi() ) - 1 /*limited to pi len, but show 1/3 digs.*/ |
numeric digits length(pi() ) - 1 /*limited to pi len, but show 1/3 digs.*/ |
||
parse value orbV(1, |
parse value orbV(1, .1, 0, 355/(113*6), 0, 0) with position '~' speed |
||
say ' position:' show(position) |
say ' position:' show(position) |
||
say ' speed:' show(speed) |
say ' speed:' show(speed) |
||
exit /*stick a fork in it, we're all done. */ |
exit /*stick a fork in it, we're all done. */ |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
orbV: procedure; parse arg semiMaj, eccentricity, inclination, node, periapsis, anomaly |
orbV: procedure; parse arg semiMaj, eccentricity, inclination, node, periapsis, anomaly |
||
Line 967: | Line 958: | ||
return mulV( MA(i,c,j,s), r)'~'mulV( divV( speed, absV(speed)),sqrt(2/r -1/semiMaj)) |
return mulV( MA(i,c,j,s), r)'~'mulV( divV( speed, absV(speed)),sqrt(2/r -1/semiMaj)) |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
MA: procedure; parse arg x y z,a,xx yy zz,b; return (x*a+xx*b) (y*a+yy*b) (z*a+zz*b) |
MA: procedure; parse arg x y z,a,xx yy zz,b; return (x*a+xx*b) (y*a+yy*b) (z*a+zz*b) |
||
⚫ | |||
⚫ | |||
⚫ | |||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
cos: procedure; parse arg x; x= r2r(x); a=abs(x); hpi= pi * .5 |
cos: procedure; parse arg x; x= r2r(x); a=abs(x); hpi= pi * .5 |