Main Content

tform2quat

Extract quaternion from homogeneous transformation

Description

example

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

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×40 1 0 0

Input Arguments

collapse all

Homogeneous transformation, specified by a 4-by-4-by-nmatrix ofnhomogeneous 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 ann4矩阵containingnquaternions. Each quaternion, one per row, is of the formq= [wxyz], withwas 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

See Also