Path: AerospaceUtils/Coord
% Rotate about an axis to align "ua" as close as possible to target "ut" -------------------------------------------------------------------------- Form: QRotateToAlign; % demo with random axis [qRot,ub,rotAngle,sepAngle] = QRotateToAlign( axis, ua, uat); -------------------------------------------------------------------------- ------ Inputs ------ axis (3,1) Axis of rotation ua (3,1) Vector to align ut (3,:) Target vector to be aligned with ------- Outputs ------- qRot (4,1) Quaternion that rotates ua to ub about axis ub (3,1) Vector achieved after rotation rotAngle (4,1) Angular rotation about the axis sepAngle (4,1) Separation angle between ub and ut --------------------------------------------------------------------------