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 ) INPUTS 1 - Finds the closest 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 INPUTS 7 - Creates the full 3x3 rotation matrix from its first 2 rows R - 2x3 first two rows of the 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 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 R3 = 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,:) ) See also