<< CL_rot_contQuat Coordinates and frames CL_rot_defQuat >>

CelestLab >> Coordinates and frames > CL_rot_defFrameVec

CL_rot_defFrameVec

Frame definition based on 2 vectors.

Calling Sequence

[M,Inok] = CL_rot_defFrameVec(u,v,n1,n2 [,res='m' ,meth])
[q,Inok] = CL_rot_defFrameVec(u,v,n1,n2, res='q' [,meth])

Description

Parameters

u:

First vector (3xN or 3x1)

v:

Second vector (3xN or 3x1)

n1:

First axis number (axis colinear with u). Possibles values are: 1, 2 or 3 (1x1)

n2:

Second axis number (axis in the (u,v) plane). Possibles values are: 1, 2, 3 (1x1)

res:

(optional, string) Type of result: 'm': frame transformation matrix, q: rotation quaternion. Default is 'm'

meth:

(optional, string) Method used: 'm': Method based on matrices (faster), 'q': method based on quaternions (result consistent with CL_rot_defRotVec). Default is 'm'

M/q:

Frame transformation matrix (3x3xN) or rotation quaternion (dim N)

Inok:

Indices for which the new frame is not uniquely defined.

Authors

See also

Examples

CL_rot_defFrameVec([1;0;0], [1;1;0], 1, 2) // => identity

// Computes local orbital frame:
kep = [7000.e3; 0.01; %pi/3 ; 0 ; 0; 0]; // orbital elements
[r,v] = CL_oe_kep2car(kep); // position and velocity

M = CL_rot_defFrameVec(r, v, 1, 2) // => "qsw" local frame
q = CL_rot_defFrameVec(-r, v, 3, 1, res='q')  //=> "lvlh" local frame

Report an issue
<< CL_rot_contQuat Coordinates and frames CL_rot_defQuat >>