Documentation

tform2rotm

Extract rotation matrix from homogeneous transformation

Syntax

rotm = tform2rotm(tform)

Description

example

rotm= tform2rotm(tform)extracts the rotational component from a homogeneous transformation,tform, and returns it as an orthonormal rotation matrix,rotm. The translational components oftformare ignored. The input homogeneous transformation must be in the pre-multiply form for transformations. When using the rotation matrix, premultiply it with the coordinates to be rotated (as opposed to postmultiplying).

Examples

collapse all

tform = [1 0 0 0; 0 -1 0 0; 0 0 -1 0; 0 0 0 1]; rotm = tform2rotm(tform)
rotm = 1 0 0 0 -1 0 0 0 -1

Input Arguments

collapse all

Homogeneous transformation matrix, specified by a 4-by-4-by-nmatrix ofnhomogeneous transformations. The input homogeneous transformation must be in the pre-multiply form for transformations.

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

Output Arguments

collapse all

Rotation matrix, returned as a 3-by-3-by-nmatrix containingnrotation matrices. Each rotation matrix has a size of 3-by-3 and is orthonormal. When using the rotation matrix, premultiply it with the coordinates to be rotated (as opposed to postmultiplying).

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

Extended Capabilities

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

See Also

Introduced in R2015a

Was this topic helpful?