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

```   vrotv_c ( Vector rotation about an axis )

void vrotv_c ( ConstSpiceDouble  v     [3],
ConstSpiceDouble  axis  [3],
SpiceDouble       theta,
SpiceDouble       r     [3] )

```

#### Abstract

```   Rotate a vector about a specified axis vector by a specified
angle and return the rotated vector.
```

```   ROTATION
```

#### Keywords

```   ROTATION
VECTOR

```

#### Brief_I/O

```   VARIABLE  I/O  DESCRIPTION
--------  ---  --------------------------------------------------
v          I   Vector to be rotated.
axis       I   Axis of the rotation.
theta      I   Angle of rotation (radians).
r          O   Result of rotating `v' about axis by `theta'.
```

#### Detailed_Input

```   v           is a 3-dimensional vector to be rotated.

axis        is the axis about which the rotation is to be
performed.

theta       is the angle through which `v' is to be rotated about
axis.
```

#### Detailed_Output

```   r           is the result of rotating `v' about `axis' by `theta'.
If `axis' is the zero vector, r = v.
```

#### Parameters

```   None.
```

#### Exceptions

```   Error free.

1)  If the input axis is the zero vector, `r' will be returned
as `v'.
```

#### Files

```   None.
```

#### Particulars

```   This routine computes the result of rotating (in a right handed
sense) the vector v about the axis represented by axis through

If w is a unit vector parallel to axis, then r is given by:

r = v + ( 1 - cos(theta) ) (w X(w X v)) + sin(theta) (w X v)

where "X" above denotes the vector cross product.
```

#### Examples

```   If axis = ( 0, 0, 1 ) and theta = pi/2 then the following results
for r will be obtained

v                           r
-------------             ----------------
( 1, 2, 3 )                ( -2, 1, 3 )
( 1, 0, 0 )                (  0, 1, 0 )
( 0, 1, 0 )                ( -1, 0, 0 )

If axis = ( 0, 1, 0 ) and theta = pi/2 then the following results
for r will be obtained

v                           r
-------------             ----------------
( 1, 2, 3 )                (  3, 2, -1 )
( 1, 0, 0 )                (  0, 0, -1 )
( 0, 1, 0 )                (  0, 1,  0 )

If axis = ( 1, 1, 1 ) and theta = pi/2 then the following results
for r will be obtained

v                                     r
-----------------------------      -----------------------------
( 1.0,     2.0,     3.0     )      ( 2.577.., 0.845.., 2.577.. )
( 2.577.., 0.845.., 2.577.. )      ( 3.0      2.0,     1.0     )
( 3.0      2.0,     1.0     )      ( 1.422.., 3.154.., 1.422.. )
( 1.422.., 3.154.., 1.422.. )      ( 1.0      2.0,     3.0     )
```

#### Restrictions

```   None.
```

#### Literature_References

```   None.
```

#### Author_and_Institution

```   N.J. Bachman        (JPL)
J. Diaz del Rio     (ODC Space)
H.A. Neilan         (JPL)
W.L. Taber          (JPL)
```

#### Version

```   -CSPICE Version 1.0.2, 05-JUL-2021 (JDR)

Edited the header to comply with NAIF standard.

-CSPICE Version 1.0.1, 05-FEB-2003 (NJB)

Header examples were corrected. -Exceptions section filled in.
```   vector rotation about an axis
`Fri Dec 31 18:41:15 2021`