<< CL_rot_defQuat Coordinates and frames CL_rot_defRot2Ax >>

CelestLab >> Coordinates and frames > CL_rot_defRot1Ax

CL_rot_defRot1Ax

Determination of a rotation around one axis.

Calling Sequence

[qa,anga,Inok] = CL_rot_defRot1Ax(u,axis,d,target_ang [,numsol=1] )
[qa,anga,qb,angb,Inok] = CL_rot_defRot1Ax(u,axis,d,target_ang, numsol=2)

Description

Parameters

u:

Vector to be rotated (3xN or 3x1)

axis:

Axis: vector (3xN or 3x1) or number (1x1)

d:

Some direction (3xN or 3x1)

target_ang:

(optional) Desired angle between d and the image of u by the rotation (1xN or 1x1)

numsol:

(optional, integer) Number of solutions returned: 1 or 2. Default is 1

qa:

Quaternion that defines the rotation (first solution) (dim N)

anga:

Rotation angle (first solution) (1xN)

qb:

Quaternion that defines the rotation (second solution) (dim N)

angb:

Rotation angle (second solution) (1xN)

Inok:

Indices for which the desired angle between d and the image of u by the rotation cannot be achieved.

Authors

See also

Examples

// Example1: Rotation about x-axis that transforms
// u into a vector perpendicular to d
u = [ 1 ; 2 ; 3 ];
d = [ 3 ; 1 ; 2 ];
[q, ang, Inok] = CL_rot_defRot1Ax(u, 1, d, %pi/2);
// Check result :
v = CL_rot_rotVect(q,u);
CL_vectAngle(v,d)  // == %pi/2

// Example2: Rotation about an axis that transforms u
// into a vector as close as possible to d
u = [ 1 ; 2 ; 3 ];
d = [ 3 ; 1 ; 2 ];
axis = [-2;3;4];
[q, ang, Inok] = CL_rot_defRot1Ax(u, axis, d, 0);
// Check result :
ang = CL_vectAngle(d,CL_rot_rotVect(q,u))
angmin_approx = min(CL_vectAngle(d,CL_rot_rotVect( ..
CL_rot_axAng2quat(axis,linspace(0,2*%pi,200)),u)))

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