Abstract I/O Examples Particulars Required Reading Version Index_Entries
```
```

#### Abstract

```
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.

For important details concerning this module's function, please refer to
the CSPICE routine ducrss_c.

```

#### I/O

```
Given:

s1   a double precision 6-vector defining a state;

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. 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.

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'.

Programmatically:

'sout' may overwrite 's1' or 's2'.

```

#### Examples

```
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.

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 a primary plane of the frame.

;;
;; Load SPK, PCK, and LSK kernels, use a meta kernel for convenience.
;;
cspice_furnsh, 'standard.tm'

;;
;; Define the earth body-fixed pole vector (z). The pole
;; has no velocity in the earth fixed frame "IAU_EARTH."
;;
z_earth = [ 0.D, 0, 1, 0, 0, 0 ];

;;
;; Calculate the state transformation between IAU_EARTH and J2000
;; at an arbitrary epoch.
;;
utc     = 'Jan 1, 2009'

cspice_str2et, utc, et
cspice_sxform, 'IAU_EARTH', 'J2000', et, trans

;;
;; Transform the earth pole vector from the IAU_EARTH frame to J2000.
;;
z_j2000 = transpose(trans) # z_earth

;;
;; Calculate the apparent state of the sun from earth at the epoch
;; 'et' in the J2000 frame.
;;
target   = 'Sun'
observer = 'Earth'

cspice_spkezr, target, et, 'J2000', 'LT+S', observer, 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, z_j2000, z_new
cspice_ducrss, z_new, state , y_new

print, 'x_new'
print, transpose(x_new)
print

print, 'y_new'
print, transpose(y_new)
print

print, 'z_new'
print, transpose(z_new)
print

;;
;; It's always good form to unload kernels after use,
;; particularly in IDL due to data persistence.
;;
cspice_kclear

IDL outputs:

x_new
0.18344664
-0.90191966
-0.39100927
2.0244977e-07
3.4660106e-08
1.5033142e-08

y_new
0.078846540
-0.38297808
0.92038634
8.2383679e-08
3.2309413e-08
6.3865886e-09

z_new
-0.97986252
-0.19967151
0.00085720385
4.4531142e-08
-2.1853107e-07
-3.6140021e-11

These vectors define the transformation between the new frame and J2000.

-            -
|       :      |
|   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]) ]

```

#### Particulars

```
The frame transformation described in the Example may also be implemented
using a dynamic frames kernel.

```

```
FRAMES.REQ
ICY.REQ

```

#### Version

```
-Icy Version 1.0.1, 09-MAY-2016, EDW (JPL)

Eliminated typo in example code; no change to functionality.

-Icy Version 1.0.0, 20-APR-2010, EDW (JPL)

```

#### Index_Entries

```
compute a unit cross product and its derivative

```
`Wed Apr  5 17:58:00 2017`