Frame definition based on 2 vectors.
[M,Inok] = CL_rot_defFrameVec(u,v,n1,n2 [,res='m' ,meth]) [q,Inok] = CL_rot_defFrameVec(u,v,n1,n2, res='q' [,meth])
This function defines a new frame based on 2 vectors.
Considering two vectors u and v, the new frame basis vectors are such that:
- n1 axis: aligned with u (and with same direction)
- n2 axis: in the half-plane delimited by u and containing v
where n1 and n2 are axis numbers: 1=>x-axis, 2=>y-axis, 3=>z-axis.
If u and v are (nearly) aligned or if n1 and n2 are identical, the basis vectors are such that:
- n1 axis: aligned with u (and same direction)
- other axes: perpendicular to n1 axis (arbitrary directions).
The outputs are:
- M: Transformation matrix from the (implicit) reference frame to the new frame defined by u and v,
- q: Quaternion of the rotation that transforms the axes of the (implicit) reference frame into the axes of the new frame defined by u and v,
- Inok: Row vector that contains the indices for which the new frame is not uniquely defined.
Note:
- CL_rot_defFrameVec(u,[],n1,[]) is equivalent to: CL_rot_defFrameVec(u,u,n1,n1).
First vector (3xN or 3x1)
Second vector (3xN or 3x1)
First axis number (axis colinear with u). Possibles values are: 1, 2 or 3 (1x1)
Second axis number (axis in the (u,v) plane). Possibles values are: 1, 2, 3 (1x1)
(optional, string) Type of result: 'm': frame transformation matrix, q: rotation quaternion. Default is 'm'
(optional, string) Method used: 'm': Method based on matrices (faster), 'q': method based on quaternions (result consistent with CL_rot_defRotVec). Default is 'm'
Frame transformation matrix (3x3xN) or rotation quaternion (dim N)
Indices for which the new frame is not uniquely defined.
CNES - DCT/SB