Table of contents
CSPICE_ROTVEC transforms a vector to a new reference frame rotated by
`angle' radians about axis `iaxis'. This transformation rotates `v1' by
-angle radians about the specified axis.
Given:
v1 a vector (typically representing a vector fixed in inertial
space) which is to be expressed in another reference frame.
help, v1
DOUBLE = Array[3]
The vector remains fixed but the reference frame changes.
angle an angle given in radians, through which the rotation is
performed.
help, angle
DOUBLE = Scalar
iaxis the index of the axis of rotation.
help, iaxis
LONG = Scalar
The X, Y, and Z axes have indices 1, 2 and 3 respectively.
the call:
cspice_rotvec, v1, angle, iaxis, vout
returns:
vout the vector expressed in the new reference frame specified by the
angle of rotation and axis.
help, vout
DOUBLE = Array[3]
If
m = [angle]
iaxis
represents the rotation matrix described by the `angle'
and `iaxis', (refer to the routine cspice_rotate) then
vout = m * v1 = [angle] * v1
iaxis
None.
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.
1) Apply a rotation of -45.D0 degrees about the +Z axis to
a 3 dimensional vector.
Example code begins here.
PRO rotvec_ex1
;;
;; Input values.
;;
v1 = [1.414, 0.0, 0.0]
angle = cspice_pi( )/4
iaxis = 3
;;
;; Rotate V1 by ANGLE radians about IAXIS
;;
cspice_rotvec, v1, angle, iaxis, vout
print, format='(A,3F10.3)', 'Input vector :', $
v1[0], v1[1], v1[2]
print, format='(A,3F10.3)', 'Rotated vector:', $
vout[0], vout[1], vout[2]
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Input vector : 1.414 0.000 0.000
Rotated vector: 1.000 -1.000 0.000
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 |
`- -'
cspice_rotvec decides which form is appropriate according to the value
of `iaxis' and applies the rotation to the input vector.
1) If the `iaxis' 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.
2) If any of the input arguments, `v1', `angle' or `iaxis', is
undefined, an error is signaled by the IDL error handling
system.
3) If any of the input arguments, `v1', `angle' or `iaxis', is
not of the expected type, or it does not have the expected
dimensions and size, an error is signaled by the Icy
interface.
4) If the output argument `vout' is not a named variable, an
error is signaled by the Icy interface.
None.
None.
ICY.REQ
ROTATION.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.2, 10-AUG-2021 (JDR)
Edited the header to comply with NAIF standard. Added complete code
example.
Added -Parameters, -Particulars, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section and improved its contents.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.1, 09-DEC-2005 (EDW)
Added -Examples section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
rotate a vector
|