/* -Procedure twovec_c ( Two vectors defining an orthonormal frame ) -Abstract Find the transformation to the right-handed frame having a given vector as a specified axis and having a second given vector lying in a specified coordinate plane. -Copyright Copyright (1995), California Institute of Technology. U.S. Government sponsorship acknowledged. -Required_Reading None. -Keywords AXES, FRAME, ROTATION, TRANSFORMATION */ #include "SpiceUsr.h" #include "SpiceZfc.h" void twovec_c ( SpiceDouble axdef [3], SpiceInt indexa, SpiceDouble plndef [3], SpiceInt indexp, SpiceDouble mout [3][3] ) /* -Brief_I/O VARIABLE I/O DESCRIPTION -------- --- ------------------------------------------------- axdef I Vector defining a principal axis. indexa I Principal axis number of axdef (X=1, Y=2, Z=3). plndef I Vector defining (with axdef) a principal plane. indexp I Second axis number (with indexa) of principal plane. mout O Output rotation matrix. -Detailed_Input axdef is a vector defining one of the principal axes of a coordinate frame. indexa is a number that determines which of the three coordinate axes contains axdef. 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 is a vector defining (with axdef) a principal plane of the coordinate frame. indexp is the second axis of the principal frame determined by axdef and plndef. 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. -Detailed_Output mout is a rotation matrix that transforms coordinates given in the input frame to the frame determined by axdef, plndef, indexa and indexp. -Parameters None. -Exceptions 1) If indexa or indexp is not in the set {1,2,3} the error SPICE(BADINDEX) will be signalled. 2) If indexa and indexp are the same the error SPICE(UNDEFINEDFRAME) will be signalled. 3) If the cross product of the vectors axdef and plndef is zero, the error SPICE(DEPENDENTVECTORS) will be signalled. -Files None. -Particulars 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. -Examples The rotation matrix ticc from inertial to Sun-Canopus (celestial) coordinates is found by the call twovec_c ( Sun_vector, 3, Canopus_vector, 1, ticc ); -Restrictions indexa, indexp must be different and be integers from 1 to 3. axdef and plndef must be linearly independent. -Author_and_Institution W.M. Owen (JPL) W.L. Taber (JPL) -Literature_References None. -Version -CSPICE Version 1.0.0, 2-MAR-1998 -Index_Entries define an orthonormal frame from two vectors -& */ { /* Begin twovec_c */ /* Participate in error tracing. */ chkin_c ( "twovec_c" ); /* Call the f2c'd routine. */ twovec_ ( ( doublereal * ) axdef, ( integer * ) &indexa, ( doublereal * ) plndef, ( integer * ) &indexp, ( doublereal * ) mout ); /* Transpose the output matrix to put it in row-major order. */ xpose_c ( mout, mout ); chkout_c ( "twovec_c" ); } /* End twovec_c */