Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X
xf2rav_c

 Procedure Abstract Required_Reading Keywords Brief_I/O Detailed_Input Detailed_Output Parameters Exceptions Files Particulars Examples Restrictions Literature_References Author_and_Institution Version Index_Entries

#### Procedure

```   xf2rav_c ( Transform to rotation and angular velocity)

void xf2rav_c ( ConstSpiceDouble   xform [6][6],
SpiceDouble        rot   [3][3],
SpiceDouble        av    [3]     )

```

#### Abstract

```   Determine the rotation matrix and angular velocity of the
rotation from a state transformation matrix.
```

```   ROTATION
```

#### Keywords

```   FRAMES

```

#### Brief_I/O

```   VARIABLE  I/O  DESCRIPTION
--------  ---  --------------------------------------------------
xform      I   is a state transformation matrix.
rot        O   is the rotation associated with `xform'.
av         O   is the angular velocity associated with `xform'.
```

#### Detailed_Input

```   xform       is a state transformation matrix from one frame
FRAME1 to some other frame FRAME2.
```

#### Detailed_Output

```   rot         is a rotation that gives the transformation from
some frame FRAME1 to another frame FRAME2.

av          is the angular velocity of the transformation.
In other words, if `p' is the position of a fixed
point in FRAME2, then from the point of view of
FRAME1, `p' rotates (in a right handed sense) about
an axis parallel to `av'. Moreover the rate of rotation
in radians per unit time is given by the length of
`av'.

More formally, the velocity `v' of `p' in FRAME1 is
given by
T
v  = av x ( rot  * p )

The components of `av' are given relative to FRAME1.
```

#### Parameters

```   None.
```

#### Exceptions

```   Error free.

1)  No checks are performed on `xform' to ensure that it is indeed
a state transformation matrix.
```

#### Files

```   None.
```

#### Particulars

```   This routine is essentially a macro routine for converting
state transformation matrices into the equivalent representation
in terms of a rotation and angular velocity.

This routine is an inverse of the routine rav2xf_c.
```

#### Examples

```   The numerical results shown for this example may differ across
platforms. The results depend on the SPICE kernels used as
input, the compiler and supporting libraries, and the machine
specific arithmetic implementation.

1) Suppose that you wanted to determine the angular velocity
of the Earth body-fixed reference frame with respect to
J2000 at a particular epoch ET. The following code example
illustrates a procedure for computing the angular velocity.

Use the meta-kernel shown below to load the required SPICE
kernels.

KPL/MK

File name: xf2rav_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
---------                     --------
earth_720101_070426.bpc       Earth historical
binary PCK
naif0012.tls                  Leapseconds

\begindata

'naif0012.tls'            )

\begintext

End of meta-kernel

Example code begins here.

/.
Program xf2rav_ex1
./
#include <stdio.h>
#include "SpiceUsr.h"

int main( )
{

/.
Local parameters.
./
#define META         "xf2rav_ex1.tm"
#define UTCSTR       "2005-OCT-10 16:00:00"

/.
Local variables.
./
SpiceDouble          av     [3];
SpiceDouble          et;
SpiceDouble          ftmtrx [6][6];
SpiceDouble          rot    [3][3];

SpiceInt             i;

/.
./
furnsh_c ( META );

/.
Convert the input time to seconds past J2000 TDB.
./
str2et_c ( UTCSTR, &et );

/.
Get the transformation matrix from J2000 frame to
ITRF93.
./
sxform_c ( "J2000", "ITRF93", et, ftmtrx );

/.
Now get the angular velocity by calling xf2rav_c
./
xf2rav_c ( ftmtrx, rot, av );

/.
Display the results.
./
printf( "Rotation matrix:\n" );
for ( i = 0; i < 3; i++ )
{

printf( "%16.11f %15.11f %15.11f\n",
rot[i][0], rot[i][1], rot[i][2] );

}

printf( "\n" );
printf( "Angular velocity:\n" );
printf( "%16.11f %15.11f %15.11f\n", av[0], av[1], av[2] );

return ( 0 );
}

When this program was executed on a Mac/Intel/cc/64-bit
platform, the output was:

Rotation matrix:
-0.18603277688  -0.98254352801   0.00014659080
0.98254338275  -0.18603282936  -0.00053610915
0.00055402128   0.00004429795   0.99999984555

Angular velocity:
0.00000004025   0.00000000324   0.00007292114
```

#### Restrictions

```   None.
```

#### Literature_References

```   None.
```

#### Author_and_Institution

```   N.J. Bachman        (JPL)
J. Diaz del Rio     (ODC Space)
W.L. Taber          (JPL)
E.D. Wright         (JPL)
```

#### Version

```   -CSPICE Version 1.0.2, 19-MAY-2020 (JDR)

code example based on existing example.

```   State transformation to rotation and angular velocity
`Fri Dec 31 18:41:15 2021`