Table of contents
CSPICE_DUCRSS calculates the unit vector parallel to the cross product
of the position components of two state vectors and the time derivative
of this unit vector.
Given:
s1 a double precision 6-vector defining a state.
help, s1
DOUBLE = Array[6]
Typically, this might represent the apparent state of a planet
or the Sun, which defines the orientation of axes of some
coordinate system:
s1 = ( r1, dr1/dt )
s2 a second state vector:
s2 = ( r2, dr2/dt )
An implicit assumption exists that both states lie in the same
reference frame.
help, s2
DOUBLE = Array[6]
If this is not the case, the numerical result has no meaning.
the call:
cspice_ducrss, s1, s2, sout
returns:
sout a double precision 6-vector that represents the unit vector
parallel to the cross product of the position components of `s1'
and `s2' and the derivative of the unit vector.
help, sout
DOUBLE = Array[6]
If the cross product of the position components is
the zero vector, then the position component of the
output will be the zero vector. The velocity component
of the output will simply be the derivative of the
cross product of the position components of `s1' and `s2'.
None.
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
1) One can construct non-inertial coordinate frames from apparent
positions of objects or defined directions. However, if one
wants to convert states in this non-inertial frame to states
in an inertial reference frame, the derivatives of the axes of
the non-inertial frame are required.
Define a reference frame with the apparent direction of the
Sun as seen from Earth as the primary axis X. Use the Earth
pole vector to define with the primary axis the XY plane of
the frame, with the primary axis Y pointing in the direction
of the pole.
Use the meta-kernel shown below to load the required SPICE
kernels.
KPL/MK
File name: ducrss_ex1.tm
This meta-kernel is intended to support operation of SPICE
example programs. The kernels shown here should not be
assumed to contain adequate or correct versions of data
required by SPICE-based user applications.
In order for an application to use this meta-kernel, the
kernels referenced here must be present in the user's
current working directory.
The names and contents of the kernels referenced
by this meta-kernel are as follows:
File name Contents
--------- --------
de421.bsp Planetary ephemeris
pck00008.tpc Planet orientation and
radii
naif0009.tls Leapseconds
\begindata
KERNELS_TO_LOAD = ( 'de421.bsp',
'pck00008.tpc',
'naif0009.tls' )
\begintext
End of meta-kernel
Example code begins here.
PRO ducrss_ex1
;;
;; Define the earth body-fixed pole vector (z). The pole
;; has no velocity in the Earth fixed frame IAU_EARTH.
;;
z = [0.D0, 0.D0, 1.D0, 0.D0, 0.D0, 0.D0]
;;
;; Load SPK, PCK, and LSK kernels, use a meta kernel for
;; convenience.
;;
cspice_furnsh, 'ducrss_ex1.tm'
;;
;; Calculate the state transformation between IAU_EARTH and
;; J2000 at an arbitrary epoch.
;;
cspice_str2et, 'Jan 1, 2009', et
cspice_sxform, 'IAU_EARTH', 'J2000', et, trans
;;
;; Transform the earth pole vector from the IAU_EARTH frame
;; to J2000.
;;
zinert = transpose(trans) # z
;;
;; Calculate the apparent state of the Sun from Earth at
;; the epoch `et' in the J2000 frame.
;;
cspice_spkezr, 'Sun', et, 'J2000', 'lt+s', 'Earth', state, ltime
;;
;; Define the z axis of the new frame as the cross product
;; between the apparent direction of the Sun and the Earth
;; pole. `z_new' cross `x_new' defines the Y axis of the
;; derived frame.
;;
cspice_dvhat, state, x_new
cspice_ducrss, state, zinert, z_new
cspice_ducrss, z_new, state, y_new
;;
;; Display the results.
;;
print, format='(A)', 'New X-axis:'
print, format='(A,3F16.12)', ' position:', x_new[0:2]
print, format='(A,3F16.12)', ' velocity:', x_new[3:5]
print, format='(A)', 'New Y-axis:'
print, format='(A,3F16.12)', ' position:', y_new[0:2]
print, format='(A,3F16.12)', ' velocity:', y_new[3:5]
print, format='(A)', 'New Z-axis:'
print, format='(A,3F16.12)', ' position:', z_new[0:2]
print, format='(A,3F16.12)', ' velocity:', z_new[3:5]
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
New X-axis:
position: 0.183446637633 -0.901919663328 -0.391009273602
velocity: 0.000000202450 0.000000034660 0.000000015033
New Y-axis:
position: 0.078846540163 -0.382978080242 0.920386339077
velocity: 0.000000082384 0.000000032309 0.000000006387
New Z-axis:
position: -0.979862518033 -0.199671507623 0.000857203851
velocity: 0.000000044531 -0.000000218531 -0.000000000036
Note that these vectors define the transformation between the
new frame and J2000 at the given `et':
.- -.
| : |
| R : 0 |
M = | ......:......|
| : |
| drdt : r |
`- -'
with
R = [ transpose(x_new[0:2]), $
transpose(y_new[0:2]), $
transpose(z_new[0:2]) ]
dRdt = [ transpose(x_new[3:5]), $
transpose(y_new[3:5]), $
transpose(z_new[3:5]) ]
cspice_ducrss calculates the unit vector parallel to the cross product
of two vectors and the derivative of that unit vector.
1) If the position components of `s1' and `s2' cross together to
give a zero vector, the position component of the output
will be the zero vector. The velocity component of the
output will simply be the derivative of the cross product
of the position vectors.
2) If `s1' and `s2' are large in magnitude (taken together,
their magnitude surpasses the limit allowed by the
computer) then it may be possible to generate a
floating point overflow from an intermediate
computation even though the actual cross product and
derivative may be well within the range of double
precision numbers.
3) If any of the input arguments, `s1' or `s2', is undefined, an
error is signaled by the IDL error handling system.
4) If any of the input arguments, `s1' or `s2', is not of the
expected type, or it does not have the expected dimensions and
size, an error is signaled by the Icy interface.
5) If the output argument `sout' is not a named variable, an
error is signaled by the Icy interface.
None.
1) No checking of `s1' or `s2' is done to prevent floating point
overflow. The user is required to determine that the magnitude
of each component of the states is within an appropriate range
so as not to cause floating point overflow. In almost every
case there will be no problem and no checking actually needs
to be done.
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.2, 17-JUN-2021 (JDR)
Edited the header to comply with NAIF standard. Added complete
code example from existing code fragment.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.1, 09-MAY-2016 (EDW)
Eliminated typo in example code; no change to functionality.
-Icy Version 1.0.0, 20-APR-2010 (EDW)
Compute a unit cross product and its derivative
|