Main Content

tform2trvec

Extract translation vector from homogeneous transformation

Description

trvec = tform2trvec(tform) extracts the Cartesian representation of the translation vector trvec from the homogeneous transformation tform. The rotational components of tform are ignored. The input homogeneous transformation must be in the premultiplied form for transformations.

example

Examples

collapse all

tform = [1 0 0 0.5; 0 -1 0 5; 0 0 -1 -1.2; 0 0 0 1];
trvec = tform2trvec(tform)
trvec = 1×3

    0.5000    5.0000   -1.2000

Input Arguments

collapse all

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:

T=[r11r12t1r21r22t2001]

3-D homogeneous transformation matrices are of the form:

T=[r11r12r13t1r21r22r23t2r31r32r33t30001]

Example: [0 0 1 0; 0 1 0 0; -1 0 0 0; 0 0 0 1]

Output Arguments

collapse all

Cartesian representation of a translation vector, returned 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]

More About

collapse all

Extended Capabilities

expand all

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

Version History

Introduced in R2015a

expand all