19 Jun 2009
13 Oct 2014)
Library to handle 3D geometric primitives: create, intersect, display, and make basic computations
function mat = createEulerAnglesRotation(phi, theta, psi)
%CREATEEULERANGLESROTATION Create a rotation matrix from 3 euler angles
% ROT = createEulerAnglesRotation(PHI, THETA, PSI)
% Create a rotation matrix from the 3 euler angles PHI THETA and PSI,
% in radians, using the 'XYZ' convention. These angles correspond to the
% "Roll-Pitch-Yaw" convention, also known as "TaitBryan angles".
% PHI: rotation angle around X-axis, in radians, corresponding to the
% 'Roll'. PHI is between -pi and +pi.
% THETA: rotation angle around Y-axis, in radians, corresponding to the
% 'Pitch'. THETA is between -pi/2 and pi/2.
% PSI: rotation angle around Z-axis, in radians, corresponding to the
% 'Yaw'. PSI is between -pi and +pi.
% The resulting rotation is equivalent to a rotation around X-axis by an
% angle PHI, followed by a rotation around the Y-axis by an angle THETA,
% followed by a rotation around the Z-axis by an angle PSI.
% That is:
% ROT = Rz * Ry * Rx;
% [n e f] = createCube;
% phi = 20*pi/180;
% theta = 30*pi/180;
% psi = 10*pi/180;
% rot = createEulerAnglesRotation(phi, theta, psi);
% n2 = transformPoint3d(n, rot);
% drawPolyhedron(n2, f);
% See also
% transforms3d, createRotationOx, createRotationOy, createRotationOz
% Author: David Legland
% e-mail: firstname.lastname@example.org
% Created: 2010-07-22, using Matlab 18.104.22.1689 (R2009b)
% Copyright 2010 INRA - Cepia Software Platform.
% 2011-06-20 deprecate
'Deprecated function, use ''eulerAnglesToRotation3d'' instead');
% create individual rotation matrices
rotX = createRotationOx(phi);
rotY = createRotationOy(theta);
rotZ = createRotationOz(psi);
% concatenate matrices
mat = rotZ * rotY * rotX;