


Performs different operations dealing with a rotation matrix
USAGE
R = rotationMatrix( M )
[u,theta] = rotationMatrix( R )
R = rotationMatrix( theta )
R = rotationMatrix( u )
R = rotationMatrix( u, theta )
R = rotationMatrix( th1, th2, th3 )
R = rotationMatrix( R2 )
INPUTS 1 - Finds the closest rotation matrix to a given matrix M
M - 3x3 matrix
INPUTS 2 - Extract the axis and the angle of a 3x3 rotation matrix
R - 3x3 Rotation matrix
INPUTS 3 - Creates a 2x2 rotation matrix from an angle
theta - angle of rotation (radians)
INPUTS 4 - Creates a 3x3 rotation matrix from a rotation vector
u - 1x3 or 3x1 axis of rotation - norm is theta
INPUTS 5 - Creates a 3x3 rotation matrix from a rotation vector
u - axis of rotation
theta - angle of rotation (radians)
INPUTS 6 - Creates a 3x3 rotation matrix from 3 angles (around fixed
axes)
th1 - angle with respect to X axis
th2 - angle with respect to Y axis
th3 - angle with respect to Z axis
such that R = Rx*Ry*Rz
INPUTS 7 - Creates the full 3x3 rotation matrix from its first 2 rows
R - 2x3 first two rows of the rotation matrix
INPUTS 8 - Extract the 3 angles of a 3x3 rotation matrix
R - 3x3 Rotation matrix
OUTPUTS 1,4,5,6,7
R - 3x3 rotation matrix
OUTPUTS 2
u - axis of rotation
theta - angle of rotation (radians)
OUTPUTS 3
R - 2x2 Rotation matrix
OUTPUTS 8
th1 - angle with respect to X axis
th2 - angle with respect to Y axis
th3 - angle with respect to Z axis
such that R = Rx*Ry*Rz
EXAMPLE 1
R3 = rotationMatrix( [0 0 1], pi/4 )+rand(3)/50
R3r = rotationMatrix( R3 )
[u,theta] = rotationMatrix( R3r )
EXAMPLE 2
R3 = rotationMatrix( [0 0 1], pi/4 );
[u,theta] = rotationMatrix( R3 )
EXAMPLE 3
R2 = rotationMatrix( pi/4 )
EXAMPLE 4
R3 = rotationMatrix( [0 0 .5] )
EXAMPLE 5
R3 = rotationMatrix( [0 0 1], pi/4 )
EXAMPLE 6
R3 = rotationMatrix( pi/4,pi/4,0 )
EXAMPLE 7
R3 = rotationMatrix( pi/4,pi/4,0 )
R3bis = rotationMatrix( R3(1:2,:) )
EXAMPLE 7
[th1 th2 th3] = rotationmatrix( rotationMatrix( pi/4,pi/4,0 ) );
EXAMPLE 8
[th1 th2 th3]=rotationMatrix(rotationMatrix(1,2,3))
See also
Piotr's Image&Video Toolbox Version 2.35
Copyright 2009 Piotr Dollar. [pdollar-at-caltech.edu]
Please email me if you find bugs, or have suggestions or questions!
Licensed under the Lesser GPL [see external/lgpl.txt]