Table of contents
CSPICE_TWOVEC calculates the transformation matrix to the
right-handed reference frame having an input vector as a
specified axis and a second input vector lying in a
define coordinate plane.
Given:
axdef a vector defining one of the principle axes of a coordinate
frame.
help, axdef
DOUBLE = Array[3]
indexa a number that determines which of the three coordinate axes
contains `axdef'.
help, indexa
LONG = Scalar
If `indexa' is 1 then `axdef' defines the X axis of the
coordinate frame.
If `indexa' is 2 then `axdef' defines the Y axis of the
coordinate frame.
If `indexa' is 3 then `axdef' defines the Z axis of the
coordinate frame.
plndef a vector defining (with `axdef') a principal plane of the
coordinate frame.
help, plndef
DOUBLE = Array[3]
`axdef' and `plndef' must be linearly independent.
indexp the second axis of the principal frame determined by `axdef' and
`plndef'.
help, indexp
LONG = Scalar
`indexa', `indexp' must be different and be integers from 1 to
3.
If `indexp' is 1, the second axis of the principal
plane is the X-axis.
If `indexp' is 2, the second axis of the principal
plane is the Y-axis.
If `indexp' is 3, the second axis of the principal plane
is the Z-axis.
the call:
cspice_twovec, axdef, indexa, plndef, indexp, mout
returns:
mout a rotation matrix that transforms coordinates given in the input
frame to the frame determined by `axdef', `plndef', `indexa' and
`indexp'.
help, mout
DOUBLE = Array[3,3]
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) Calculate the transformation matrix to the right-handed
reference frame having the +i unit vector as primary axis,
aligned to the frame's +X axis, and the -j unit vector as
secondary axis, aligned to the +Y axis.
Example code begins here.
PRO twovec_ex1
;;
;; A trivial example. Define the reference vectors...
;;
;; The i unit vector
;;
axdef = [ 1.d, 0.d, 0.d]
indexa = 1
;;
;; The -j unit vector. For this example, any vector
;; in the x-y plane will suffice.
;;
plndef = [ 0.d, -1.d, 0.d]
indexp = 2
;;
;; Calculate the transformation matrix. The new frame
;; has axdef as axis indexa, with plndef in the same
;; plane, the direction axis indexp in that plane
;; and orthogonal to axdef. A third direction vector
;; completes the right handed frame.
;;
cspice_twovec, axdef, indexa, plndef, indexp, mout
print, mout
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
1.0000000 0.0000000 0.0000000
0.0000000 -1.0000000 0.0000000
0.0000000 0.0000000 -1.0000000
Given two linearly independent vectors there is a unique
right-handed coordinate frame having:
1) `axdef' lying along the `indexa' axis.
2) `plndef' lying in the indexa-indexp coordinate plane.
This routine determines the transformation matrix that transforms
from coordinates used to represent the input vectors to the
the system determined by `axdef' and `plndef'. Thus a vector
(x,y,z) in the input coordinate system will have coordinates
t
mout * (x,y,z)
in the frame determined by `axdef' and `plndef'.
1) If `indexa' or `indexp' is not in the set {1,2,3}, the error
SPICE(BADINDEX) is signaled by a routine in the call tree of
this routine.
2) If `indexa' and `indexp' are the same, the error
SPICE(UNDEFINEDFRAME) is signaled by a routine in the call
tree of this routine.
3) If the cross product of the vectors `axdef' and `plndef' is zero,
the error SPICE(DEPENDENTVECTORS) is signaled by a routine in
the call tree of this routine.
4) If any of the input arguments, `axdef', `indexa', `plndef' or
`indexp', is undefined, an error is signaled by the IDL error
handling system.
5) If any of the input arguments, `axdef', `indexa', `plndef' or
`indexp', is not of the expected type, or it does not have the
expected dimensions and size, an error is signaled by the Icy
interface.
6) If the output argument `mout' is not a named variable, an
error is signaled by the Icy interface.
None.
None.
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.2, 17-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.1, 23-SEP-2008 (EDW)
Eliminated error in English.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
define an orthonormal frame from two vectors
|