testeuler2quat.m

来自「众所周知」· M 代码 · 共 42 行

M
42
字号
clc, close all, clear all
format 

dx=160; dy=100; dz=120;               % euler angles in degree  

D2R=pi/180;                           % for converting degree to radians
rx=dx.*D2R; ry=dy.*D2R;   rz=dz.*D2R; % euler angles in radinas  

% % x i.e. roll
% % y i.e. pitch
% % z i.e. yaw
% % Quaterion is expressed as Q=[w x y z]
% % w is scalar component of quaternion
% % x,y,z are vector components of quaternion. For example q=w+xi+yj+zk

% % euler2quat converts euler angles to quaternion for six basic sequence
% % of rotations.
% % Allowed rotation sequences: xyz, xzy, yxz, yzx, zxy, zyx 

[w,x,y,z]=euler2quat(rx,ry,rz,'xyz');  %order of rotation is 'xyz'
q=[w x y z]
[w,x,y,z]=euler2quat(rx,ry,rz,'xzy'); %order of rotation is 'xzy'
 q=[w x y z]
% [w,x,y,z]=euler2quat(rx,ry,rz,'yxz');
% q=[w x y z]
% [w,x,y,z]=euler2quat(rx,ry,rz,'yzx');
% q=[w x y z]
% [w,x,y,z]=euler2quat(rx,ry,rz,'zxy');
% q=[w x y z]
% [w,x,y,z]=euler2quat(rx,ry,rz,'zyx');
% q=[w x y z]



% Technical Reference: Ken Shoemake, "Animating Rotations with Quaternion Curves"

% This program or any other program(s) supplied with it does not provide any
% warranty direct or implied. This program is free to use/share for
% non-commerical purpose. 
% contact: khan_goodluck@yahoo.com

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?