Main Content

tform2quat

Extract quaternion from homogeneous transformation

Description

quat = tform2quat(tform) extracts the rotational component from a homogeneous transformation, tform, and returns it as a quaternion, quat. The translational components of tform are ignored. The input homogeneous transformation must be in the premultiply form for transformations.

example

Examples

collapse all

tform = [1 0 0 0; 0 -1 0 0; 0 0 -1 0; 0 0 0 1];
quat = tform2quat(tform)
quat = 1×4

     0     1     0     0

Input Arguments

collapse all

Homogeneous transformation, specified by a 4-by-4-by-n matrix of n homogeneous transformations. The input homogeneous transformation must be in the premultiply form for transformations.

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

Output Arguments

collapse all

Unit quaternion, returned as an n-by-4 matrix containing n quaternions. Each quaternion, one per row, is of the form q = [w x y z], with w as the scalar number.

Example: [0.7071 0.7071 0 0]

Extended Capabilities

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

Version History

Introduced in R2015a