Table of contents
CSPICE_DVCRSS calculates the cross product of the position components of
two state vectors and the time derivative of this cross product.
Given:
s1 a double precision 6-vector defining a state:
s1 = ( r1, dr1/dt )
Typically, this might represent the apparent state of a planet
or the Sun, which defines the orientation of axes of some
coordinate system.
help, s1
DOUBLE = Array[6]
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_dvcrss, s1, s2, sout
returns:
sout the state associated with the cross product of the position
components of `s1' and `s2'.
help, sout
DOUBLE = Array[6]
In other words, if s1 = (p1,v1) and s2 = (p2,v2) then `sout' is
( p1xp2, d/dt( p1xp2) ).
`sout' may overwrite 's1' or 's2'.
None.
Any numerical results shown for these examples may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
1) Compute the cross product of two 3-dimensional vectors
and the derivative of this cross product.
Example code begins here.
PRO dvcrss_ex1
;;
;; Set `s1' and `s2' vectors.
;;
s1 = [ [ 0.D0, 1.D0, 0.D0, 1.D0, 0.D0, 0.D0 ], $
[ 5.D0, 5.D0, 5.D0, 1.D0, 0.D0, 0.D0 ] ]
s2 = [ [ 1.D0, 0.D0, 0.D0, 1.D0, 0.D0, 0.D0 ], $
[ -1.D0, -1.D0, -1.D0, 2.D0, 0.D0, 0.D0 ]]
;;
;; For each vector `s1' and `s2', compute their cross product
;; and its derivative.
;;
for i=0L, 1L do begin
cspice_dvcrss, s1[*,i], s2[*,i], sout
print, format='(A,6F7.1)', 'S1 :', s1[*,i]
print, format='(A,6F7.1)', 'S2 :', s2[*,i]
print, format='(A,6F7.1)', 'SOUT:', sout
print
endfor
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
S1 : 0.0 1.0 0.0 1.0 0.0 0.0
S2 : 1.0 0.0 0.0 1.0 0.0 0.0
SOUT: 0.0 0.0 -1.0 0.0 0.0 -1.0
S1 : 5.0 5.0 5.0 1.0 0.0 0.0
S2 : -1.0 -1.0 -1.0 2.0 0.0 0.0
SOUT: 0.0 0.0 0.0 0.0 11.0 -11.0
2) 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: dvcrss_ex2.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 dvcrss_ex2
;;
;; 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, 'dvcrss_ex2.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 X axis of the new frame to aligned with
;; the computed state. Calculate the state's unit vector
;; and its derivative to get the X axis and its
;; derivative.
;;
cspice_dvhat, state, x_new
;;
;; Define the Z axis of the new frame as the cross product
;; between the computed state and the Earth pole.
;; Calculate the Z direction in the new reference frame,
;; then calculate the this direction's unit vector and its
;; derivative to get the Z axis and its derivative.
;;
cspice_dvcrss, state, zinert, tmpsta
cspice_dvhat, tmpsta, z_new
;;
;; As for `z_new', calculate the Y direction in the new
;; reference frame, then calculate this direction's unit
;; vector and its derivative to get the Y axis and its
;; derivative.
;;
cspice_ducrss, z_new, state, tmpsta
cspice_dvhat, tmpsta, 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_dvcrss calculates the three-dimensional cross product of two
vectors and the derivative of that cross product according to
the definition.
In this discussion, the notation
V1 x V2
indicates the cross product of vectors V1 and V2.
With s1 = (r1,v1) and s2 = (r2,v2) then
d
sout = [ r1 x r2 , -- (r1 x r2) ]
dt
1) 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.
cspice_dvcrss does NOT check the magnitude of `s1' or `s2' to
insure that overflow will not occur.
2) If any of the input arguments, `s1' or `s2', is undefined, an
error is signaled by the IDL error handling system.
3) 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.
4) If the output argument `sout' is not a named variable, an
error is signaled by the Icy interface.
None.
None.
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 first code
example and completed the second one based on existing 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 the derivative of a cross product
|