tform2rotm
Extract rotation matrix from homogeneous transformation
Syntax
Description
extracts
the rotational component from a homogeneous transformation, rotm
= tform2rotm(tform
)tform
,
and returns it as an orthonormal rotation matrix, rotm
.
The translational components of tform
are 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
Convert Homogeneous Transformation to Rotation Matrix
tform = [1 0 0 0; 0 -1 0 0; 0 0 -1 0; 0 0 0 1]; rotm = tform2rotm(tform)
rotm = 3×3
1 0 0
0 -1 0
0 0 -1
Input Arguments
tform
— Homogeneous transformation
3-by-3-by-n array | 4-by-4-by-n array
Homogeneous transformation, specified as a 3-by-3-by-n array or 4-by-4-by-n array. n is the number of homogeneous transformations. The input homogeneous transformation must be in the premultiplied form for transformations.
2-D homogeneous transformation matrices are of the form:
3-D homogeneous transformation matrices are of the form:
Example: [0 0 1 0; 0 1 0 0; -1 0 0 0; 0 0 0 1]
Output Arguments
rotm
— Rotation matrix
2-by-2-by-n array | 3-by-3-by-n array
Rotation matrix, returned as a 2-by-2-n array or 3-by-3-by-n array containing n rotation matrices. Each rotation matrix in the array has either a size of 2-by-2 or 3-by-3 and is orthonormal. When using the rotation matrix, premultiply it with the coordinates to be rotated (as opposed to postmultiplying).
2-D rotation matrices are of the form:
3-D rotation matrices are of the form:
Example: [0 0 1; 0 1 0; -1 0
0]
More About
Homogeneous Transformation Matrices
Homogeneous transformation matrices consist of both an orthogonal rotation and a translation.
2-D transformations have a rotation θ about the z-axis:
, and a translation along the x and y axis:
, resulting in the 2-D transformation matrix of the form:
3-D transformations contain information about three rotations about the x-, y-, and z-axes:
and after multiplying become the rotation about the xyz-axes:
and a translation along the x-, y-, and z-axis:
, resulting in the 3-D transformation matrix of the form:
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2015aR2023a: tform2rotm
Supports 2-D Homogeneous
Transformation Matrices
The tform
argument now accepts 2-D homogeneous
transformation matrices as a 3-by-3-by-n array
and tform2rotm
outputs 2-D rotation matrices
2-by-2-by-n array.
See Also
rotm2tform
| se2
| se3
| so2
| so3
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)