rotvec_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

```   void rotvec_c ( ConstSpiceDouble  v1    ,
SpiceDouble       angle,
SpiceInt          iaxis,
SpiceDouble       vout   )

```

#### Abstract

```
Transform a vector to a new coordinate system rotated by angle
```

```
None.
```

#### Keywords

```
ROTATION,  VECTOR

```

#### Brief_I/O

```
VARIABLE  I/O  DESCRIPTION
--------  ---  --------------------------------------------------
v1        I    Vector whose coordinate system is to be rotated.
angle     I    Angle of rotation in radians.
iaxis     I    Axis of rotation (X=1, Y=2, Z=3).
vout      O    Resulting vector [angle]      * v1 expressed in
iaxis
the new coordinate system. vout can overwrite v1.
```

#### Detailed_Input

```
v1      This is a vector (typically representing a vector fixed
in inertial space) which is to be expressed in another
coordinate system.  The vector remains fixed but the
coordinate system changes.

angle   The angle given in radians, through which the rotation
is performed.

iaxis   The index of the axis of rotation.  The X, Y, and Z
axes have indices 1, 2 and 3 respectively.
```

#### Detailed_Output

```
vout    This is the vector expressed in the new coordinate system
specified by the angle of rotation and axis. If
[angle]       represents the rotation matrix described by
iaxis
the angle and axis, (refer to the routine ROTATE)
then vout = [angle]      * v1
iaxis
```

```
None.
```

#### Exceptions

```

1) If the axis index is not in the range 1 to 3 it will be treated
the same as that integer 1, 2, or 3 that is congruent to it mod
3.
```

```
None
```

#### Particulars

```
A rotation about the first, i.e. x-axis, is described by

|  1        0          0      |
|  0   cos(theta) sin(theta)  |
|  0  -sin(theta) cos(theta)  |

A rotation about the second, i.e. y-axis, is described by

|  cos(theta)  0  -sin(theta)  |
|      0       1        0      |
|  sin(theta)  1   cos(theta)  |

A rotation about the third, i.e. z-axis, is described by

|  cos(theta) sin(theta)   0   |
| -sin(theta) cos(theta)   0   |
|       0          0       1   |

rotvec_c decides which form is appropriate according to the value
of iaxis and applies the rotation to the input vector.
```

#### Examples

```
Suppose that
v1 = (1.414, 0, 0), angle = PI/4, iaxis = 3
then after calling rotvec_c according to

rotvec_c (v1, angle, iaxis, vout)

vout will be equal to (1, -1, 0).
```

```
None
```

```
None
```

#### Author_and_Institution

```
W.M. Owen       (JPL)
W.L. Taber      (JPL)
```

#### Version

```
-CSPICE Version 1.1.1, 04-OCT-1999 (NJB)

Procedure line and abstract and were changed to dispel the
impression that the input vector is rotated by +angle

-CSPICE Version 1.1.0, 22-OCT-1998 (NJB)

```
`Wed Apr  5 17:54:42 2017`