Main Content

rotvec2mat3d

Convert 3-D rotation vector to rotation matrix

Since R2022b

    Description

    example

    rotationMatrix = rotvec2mat3d(rotationVector) returns a 3-D rotation matrix that corresponds to the input axis-angle rotation vector. The function uses the Rodrigues formula for the computation.

    Examples

    collapse all

    Create a vector representing a 90-degree rotation about the Z axis.

    rotationVector = pi/2 * [0 0 1];

    Find the equivalent rotation matrix.

    rotationMatrix = rotvec2mat3d(rotationVector)
    rotationMatrix = 3×3
    
        0.0000   -1.0000         0
        1.0000    0.0000         0
             0         0    1.0000
    
    

    Input Arguments

    collapse all

    Rotation vector, specified as a three-element vector. The vector represents the axis of rotation in 3-D, where the magnitude corresponds to the rotation angle in radians.

    Data Types: single | double

    Output Arguments

    collapse all

    Rotation of camera, returned as a 3-by-3 matrix that corresponds to the input axis-angle rotation vector.

    References

    [1] Trucco, Emanuele, and Alessandro Verri. Introductory Techniques for 3-D Computer Vision. Upper Saddle River, NJ: Prentice Hall, 1998.

    Extended Capabilities

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

    Version History

    Introduced in R2022b

    expand all