Table of contents
CSPICE_VROTV rotates a double precision 3-vector about a specified
axis vector by a specified angle (measured in radians) then
returns the rotated vector.
Given:
v a 3-dimensional vector to be rotated.
help, v
DOUBLE = Array[3]
axis the axis about which the rotation is to be performed.
help, axis
DOUBLE = Array[3]
theta the angle through which `v' is to be rotated about `axis'.
help, theta
DOUBLE = Scalar
the call:
cspice_vrotv, v, axis, theta, r
returns:
r the result of rotating `v' about `axis' by `theta'.
help, r
DOUBLE = Array[3]
If `axis' is the zero vector, r = v.
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) Given an axis and an angle of rotation, perform rotations on
various vectors.
Example code begins here.
PRO vrotv_ex1
;;
;; Given an axis of rotation and an angle of rotation.
;;
axis = [ 0.d, 0.d, 1.d]
theta = cspice_pi()/2.d0
;;
;; Perform rotations on various vectors...
;;
v1 = [ 1.d, 2.d, 3.d ]
cspice_vrotv, v1, axis, theta, r1
print, FORMAT='("Input vector :",3F12.6)', v1
print, FORMAT='("Rotated vector:",3F12.6)', r1
print
v2 = [ 1.d, 0.d, 0.d ]
cspice_vrotv, v2, axis, theta, r2
print, FORMAT='("Input vector :",3F12.6)', v2
print, FORMAT='("Rotated vector:",3F12.6)', r2
print
v3 = [ 0.d, 1.d, 0.d ]
cspice_vrotv, v3, axis, theta, r3
print, FORMAT='("Input vector :",3F12.6)', v3
print, FORMAT='("Rotated vector:",3F12.6)', r3
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Input vector : 1.000000 2.000000 3.000000
Rotated vector: -2.000000 1.000000 3.000000
Input vector : 1.000000 0.000000 0.000000
Rotated vector: 0.000000 1.000000 0.000000
Input vector : 0.000000 1.000000 0.000000
Rotated vector: -1.000000 0.000000 0.000000
This routine computes the result of rotating (in a right handed
sense) the vector `v' about the axis represented by `axis' through
an angle of `theta' radians.
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.
1) If the input axis is the zero vector, `r' will be returned
as `v'.
2) If any of the input arguments, `v', `axis' or `theta', is
undefined, an error is signaled by the IDL error handling
system.
3) If any of the input arguments, `v', `axis' or `theta', 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 `r' 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.4, 01-JUN-2021 (JDR)
Edited the header to comply with NAIF standard. Added
example's problem statement and reformatted example's output.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections, and
completed -Particulars section.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.3, 13-JUN-2011 (EDW)
Edits to comply with NAIF standard for Icy headers.
-Icy Version 1.0.2, 13-JUN-2010 (EDW)
Minor edit to code comments eliminating typo.
-Icy Version 1.0.1, 17-APR-2008 (EDW)
Clean-up edits to header.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
vector rotation about an axis
|