trvec2tform

Convert translation vector to homogeneous transformation

Description

example

tform = trvec2tform(trvec) converts the Cartesian representation of a translation vector, trvec, to the corresponding homogeneous transformation, tform. When using the transformation matrix, premultiply it with the coordinates to be transformed (as opposed to postmultiplying).

Examples

collapse all

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

collapse all

Cartesian representation of a translation vector, specified as an n-by-3 matrix containing n translation vectors. Each vector is of the form t = [x y z].

Example: [0.5 6 100]

Output Arguments

collapse all

Homogeneous transformation matrix, returned as a 4-by-4-by-n matrix of n 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]

Extended Capabilities

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

See Also

Introduced in R2015a