Main Content

so2

SO(2) rotation

Since R2023b

    Description

    The so2 object represents an SO(2) rotation in 2-D.

    For more information, see the 2-D Orthonormal Rotation Matrix section.

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

    Creation

    Description

    rotation = so2 creates an SO(2) rotation representing an identity rotation with no translation.

    rotation=[1001]

    rotation = so2(rotation) creates an SO(2) rotation rotation representing a pure rotation defined by the orthonormal rotation rotation.

    rotation=[r11r12r21r22]

    rotation = so2(transformation) creates an SO(2) rotation from the SE(2) transformation transformation.

    rotation = so2(angle,"theta") creates an SO(2) rotation rotation from a rotation angle about the z-axis angle.

    example

    Note

    If any inputs contain more than one rotation, the output rotation is an N-element array of so2 objects corresponding to each of the N input rotations.

    Input Arguments

    expand all

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

    If rotation is an array, the resulting number of created so2 objects in the output array is equal to N.

    Example: eye(2)

    Data Types: single | double

    Homogeneous transformation, specified as a 3-by-3 matrix, a 3-by-3-by-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 so2 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 so2 object creates an so2 object for each angle.

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

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

    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
    so3SO(3) rotation

    Examples

    collapse all

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

    angle = pi/4;

    Create an SO(2) rotation using the angle.

    R = so2(angle,"theta")
    R = so2
        0.7071   -0.7071
        0.7071    0.7071
    
    

    Algorithms

    expand all

    Extended Capabilities

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

    Version History

    Introduced in R2023b

    See Also

    Objects