Main Content

se2

SE(2) homogeneous transformation

Since R2022b

    Description

    The se2 object represents an SE(2) transformation as a 2-D homogeneous transformation matrix consisting of a translation and rotation.

    For more information, see the 2-D Homogeneous Transformation Matrix section.

    This object acts like a numerical matrix, enabling you to compose poses using multiplication and division.

    Creation

    Description

    Rotation Matrices, Translation Vectors, and Transformation Matrices

    transformation = se2 creates an SE(2) transformation representing an identity rotation with no translation.

    transformation=[100010001]

    transformation = se2(rotation) creates an SE(2) transformation representing a pure rotation defined by the orthonormal rotation rotation with no translation. The rotation matrix is represented by the elements in the top left of the transformation matrix.

    rotation=[r11r12r21r22]

    transformation=[r11r120r21r220001]

    transformation = se2(rotation,translation) creates an SE(2) transformation representing a rotation defined by the orthonormal rotation rotation and the translation translation. The function applies the rotation matrix first, then the translation vector, to create the transformation.

    rotation=[r11r12r21r22], translation=[t1t2]

    transformation=[r11r12t1r21r22t2001]=[10t101t2001]·[r11r120r21r220001]

    transformation = se2(transformation) creates an SE(2) transformation representing a translation and rotation as defined by the homogeneous transformation transformation.

    Other 2-D Rotations and Transformation Representations

    transformation = se2(angle,"theta") creates SE(2) transformations transformation from rotations around the z-axis, in radians. The transformation contains zero translation.

    example

    transformation = se2(angle,"theta",translation) creates SE(2) transformations from rotations around the z-axis, in radians, with translations translation.

    transformation = se2(translation,"trvec") creates an SE(2) transformation from the translation vector translation.

    transformation = se2(pose,"xytheta") creates an SE(2) transformation from the 2-D compact pose pose.

    Input Arguments

    expand all

    Orthonormal rotation, specified as a 2-by-2 matrix, a 2-by-2-by-N array, a scalar so2 object, or an N-element array of so2 objects. N is the total number of rotations.

    If rotation contains more than one rotation and you also specify translation at construction, the number of translations in translation must be one or equal to the number of rotations in rotation. The resulting number of transformation objects is equal to the value of the translation or rotation argument, whichever is larger.

    If rotation contains one rotation and you also specify translation as an N-by-2 matrix, then the resulting transformations contain the same rotation specified by rotation and the corresponding translation vector in translation. The resulting number of transformation objects is equal to the number of translations in translation.

    Example: eye(2)

    Data Types: single | double

    Translation, specified as an N-by-2 matrix. N is the total number of translations and each translation is of the form [x y].

    If translation contains more than one translation, the number of rotations in rotation must be one or equal to the number of translations in translation. The resulting number of created transformation objects is equal to the value of the translation or rotation argument, whichever is larger.

    If you specify more than one translation but only one rotation, the resulting transformations contain the same rotation specified in rotation and the corresponding translation in translation. The resulting number of created se2 objects is equal to the value of the translation.

    Example: [1 4]

    Data Types: single | double

    Homogeneous transformation, specified as a 3-by-3 matrix, a 3-by-3-N array, a scalar se3 object, or an N-element array of se2 objects. N is the total number of transformations specified.

    If transformation is an array, the resulting number of created se2 objects is equal to N.

    Example: eye(3)

    Data Types: single | double

    z-axis rotation angle, specified as an N-by-M matrix. Each element of the matrix is an angle, in radians, about the z-axis. The se2 object creates an se2 object for each angle.

    If angle is an N-by-M matrix, the resulting number of created se2 objects is equal to N.

    The rotation angle is counterclockwise positive when you look along the axis toward the origin.

    Data Types: single | double

    3-D compact pose, specified as an N-by-3 matrix, where N is the total number of compact poses. Each row is a pose, comprised of an xy position and a rotation about the z-axis, in the form [x y theta]. x, y are the xy-positions and theta is the rotation about the z-axis.

    If pose is an N-by-3 matrix, the resulting number of created se2 objects is equal to N.

    Data Types: single | double

    Object Functions

    expand all

    mtimes, *Transformation or rotation multiplication
    mrdivide, /Transformation or rotation right division
    rdivide, ./Element-wise transformation or rotation right division
    times, .*Element-wise transformation or rotation multiplication
    interpInterpolate between transformations
    distCalculate distance between transformations
    normalizeNormalize transformation or rotation matrix
    transformApply rigid body transformation to points
    rotmExtract rotation matrix
    trvecExtract translation vector
    tformExtract homogeneous transformation
    thetaConvert transformation or rotation to 2-D rotation angle
    xythetaConvert transformation or rotation to compact 2-D pose representation
    so2SO(2) rotation

    Examples

    collapse all

    Define an angle rotation of pi/4 and a xyz translation of [6 4].

    angle = pi/6;
    trvec = [2 1];

    Create an SE(2) transformation using the angle and translation.

    TF = se2(angle,"theta",trvec)
    TF = se2
        0.8660   -0.5000    2.0000
        0.5000    0.8660    1.0000
             0         0    1.0000
    
    

    Algorithms

    expand all

    Extended Capabilities

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

    Version History

    Introduced in R2022b

    expand all