Transform a vector to a new coordinate system rotated by angle radians about axis iaxis. This transformation rotates v1 by -angle radians about the specified axis.
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.
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.
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
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.
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).
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.
W.M. Owen (JPL) W.L. Taber (JPL)
-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 radians about the specified axis. -CSPICE Version 1.1.0, 22-OCT-1998 (NJB) Made input vector const. -CSPICE Version 1.0.0, 08-FEB-1998 (EDW)
rotate a vector