Main Content

rotm2tform

Convert rotation matrix to homogeneous transformation

Description

tform = rotm2tform(rotm) converts the rotation matrix rotm into a homogeneous transformation matrix tform. The input rotation matrix must be in the premultiply form for rotations. When using the transformation matrix, premultiply it by the coordinates to be transformed (as opposed to postmultiplying).

example

Examples

collapse all

rotm = [1 0 0 ; 0 -1 0; 0 0 -1];
tform = rotm2tform(rotm)
tform = 4×4

     1     0     0     0
     0    -1     0     0
     0     0    -1     0
     0     0     0     1

Input Arguments

collapse all

Rotation matrix, specified as a 2-by-2-by-n or a 3-by-3-by-n array containing n rotation matrices. Each rotation matrix is either 2-by-2 or 3-by-3 and is orthonormal. The input rotation matrix must be in the premultiplied form for rotations.

Note

Rotation matrices that are not orthonormal can be normalized with the normalize function.

2-D rotation matrices are of this form:

R=[r11r12r21r22]

3-D rotation matrices are of this form:

R=[r11r12r13r11r22r23r31r32r33]

Example: [0 0 1; 0 1 0; -1 0 0]

Output Arguments

collapse all

Homogeneous transformation, returned as a 3-by-3-by-n array or 4-by-4-by-n array. n is the number of homogeneous transformations. When using the transformation matrix, premultiply it by the coordinates to be transformed (as opposed to postmultiplying).

2-D homogeneous transformation matrices are of this form:

T=[r11r12t1r21r22t2001]

3-D homogeneous transformation matrices are of this form:

T=[r11r12r13t1r21r22r23t2r31r32r33t30001]

Example: [0 0 1 0; 0 1 0 0; -1 0 0 0; 0 0 0 1]

More About

collapse all

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2015a

expand all

See Also

| | | |