trvec2tform
Convert translation vector to homogeneous transformation
Description
Examples
Convert Translation Vector to Homogeneous Transformation
trvec = [0.5 6 100]; tform = trvec2tform(trvec)
tform = 4×4
1.0000 0 0 0.5000
0 1.0000 0 6.0000
0 0 1.0000 100.0000
0 0 0 1.0000
Input Arguments
trvec
— Cartesian representation of translation vector
n-by-2 matrix | n-by-3 matrix
Cartesian representation of a translation vector,
specified as an n-by-2 matrix if
tform
is a
3-by-3-by-n array and an
n-by-3 matrix if
tform
is a
4-by-4-by-n array.
n is the number of translation
vectors. Each vector is of the form
[x
y] or [x
y
z].
Example: [0.5 6 100]
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 rotation matrix, premultiply it with the coordinates to be rotated (as opposed to postmultiplying).
Example: [0 0 1 0; 0 1 0 0; -1 0 0 0; 0 0 0
1]
2-D homogeneous transformation matrices are of the form:
3-D homogeneous transformation matrices are of the form:
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: trvec2tform
Supports 2-D Translation
Vectors
The trvec
argument now accepts 2-D translation
vectors as a n-by-2 matrix and
trvec2tform
outputs 2-D homogeneous
transformation matrices as a 3-by-3-by-n
array.
See Also
tform2trvec
| se2
| se3
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 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)