rotm2tform
Convert rotation matrix to homogeneous transformation
Syntax
Description
converts the rotation matrix tform
= rotm2tform(rotm
)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).
Examples
Convert Rotation Matrix to Homogeneous Transformation
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
rotm
— Rotation matrix
2-by-2-by-n array | 3-by-3-by-n array
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:
3-D rotation matrices are of this form:
Example: [0 0 1; 0 1 0; -1 0 0]
Output Arguments
tform
— Homogeneous transformation
3-by-3-by-n array | 4-by-4-by-n array
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:
3-D homogeneous transformation matrices are of this form:
Example: [0 0 1 0; 0 1 0 0; -1 0 0 0; 0 0 0 1]
More About
2-D Homogeneous Transformation Matrix
2-D homogeneous transformation matrices consist of both an SO(2) rotation and an xy-translation.
To read more about SO(2) rotations, see the 2-D Orthonormal Rotation Matrix section of the so2
object.
The translation is along the x-, and y-axes as a two-element column vector:
The SO(2) rotation matrix R is applied to the translation vector t to create the homogeneous translation matrix T. The rotation matrix is present in the upper-left of the transformation matrix as 2-by-2 submatrix, and the translation vector is present as a two-element vector in the last column.
3-D Homogeneous Transformation Matrix
3-D homogeneous transformation matrices consist of both an SO(3) rotation and an xyz-translation.
To read more about SO(3) rotations, see the 3-D Orthonormal Rotation Matrix section of the so3
object.
The translation is along the x-, y-, and z-axes as a three-element column vector:
The SO(3) rotation matrix R is applied to the translation vector t to create the homogeneous translation matrix T. The rotation matrix is present in the upper-left of the transformation matrix as 3-by-3 submatrix, and the translation vector is present as a three-element vector in the last column.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2015aR2023a: rotm2tform
Supports 2-D Rotation Matrices
The rotm
argument now accepts 2-D rotation matrices as a
2-by-2-by-n array and rotm2tform
outputs 2-D transformation matrices as a 3-by-3-by-n
array.
See Also
tform2rotm
| 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)