Main Content

rigidtform3d

3-D rigid geometric transformation

Since R2022b

    Description

    A rigidtform3d object stores information about a 3-D rigid geometric transformation and enables forward and inverse transformations.

    Creation

    You can create a rigidtform3d object in these ways:

    • imregtform — Estimates a geometric transformation that maps a moving image to a fixed image using similarity optimization.

    • Functions in other toolboxes that return geometric transformations, including but not limited to:

    • The rigidtform3d function described here.

    Description

    tform = rigidtform3d creates a rigidtform3d object that performs an identity transformation.

    tform = rigidtform3d(R,Translation) creates a rigidtform3d object that performs a rigid transformation based on the specified values of the R and Translation properties. These properties indicate the rotation matrix and the amounts of translation in the x-, y-, and z-directions.

    example

    tform = rigidtform3d(eulerAngles,Translation) creates a rigidtform3d object that performs a rigid transformation based on Euler angles and the specified value of the Translation property.

    tform = rigidtform3d(A) creates a rigidtform3d object and sets the property A as the specified 3-D rigid transformation matrix.

    tform = rigidtform3d(tformIn) creates a rigidtform3d object from another geometric transformation object, tformIn, that represents a valid 3-D rigid geometric transformation.

    Input Arguments

    expand all

    Euler angles in x,y,z-order in degrees, specified as a 3-element numeric vector of the form [rx ry rz]. The Euler angles set the R property as a product of three rotation matrices according to:

     Rx = [1 0 0; 0 cosd(rx) -sind(rx); 0 sind(rx) cosd(rx)];
     Ry = [cosd(ry) 0 sind(ry); 0 1 0; -sind(ry) 0 cosd(ry)];
     Rz = [cosd(rz) -sind(rz) 0; sind(rz) cosd(rz) 0; 0 0 1];
      R = Rz*Ry*Rx;

    Data Types: double | single

    Rigid 3-D geometric transformation, specified as an affinetform3d object, rigidtform3d object, simtform3d object, or transltform3d object.

    Properties

    expand all

    Forward 3-D rigid transformation, specified as a 4-by-4 numeric matrix. When you create the object, you can also specify A as a 3-by-4 numeric matrix. In this case, the object concatenates the row vector [0 0 0 1] to the end of the matrix, forming a 4-by-4 matrix. The default of A is the identity matrix.

    The matrix A transforms the point (u, v, w) in the input coordinate space to the point (x, y, z) in the output coordinate space using the convention:

    [xyz1]=Α×[uvw1]

    For a rigid transformation, A has the form:

    Α=[R(1,1)R(1,2)R(1,3)txR(2,1)R(2,2)R(2,3)tyR(3,1)R(3,2)R(3,3)tz0001]

    where each element R(i,j) is element (i, j) of the rotation matrix specified by the R property. tx, ty, and tz are the amount of translation in the x-, y-, and z-directions, respectively, and correspond to the Translation property.

    Data Types: double | single

    Rotation matrix, specified as a 3-by-3 numeric matrix. The rotation matrix has the effect of rotating about the z-axis first, then the y-axis, and then the x-axis.

    Amount of translation, specified as a 3-element numeric vector of the form [tx ty tz].

    Data Types: double | single

    This property is read-only.

    Dimensionality of the geometric transformation for both input and output points, specified as 3.

    Data Types: double

    Object Functions

    invertInvert geometric transformation
    outputLimitsFind output spatial limits given input spatial limits
    transformPointsForwardApply forward geometric transformation
    transformPointsInverseApply inverse geometric transformation

    Examples

    collapse all

    Specify Euler angles and amounts of translation.

    angles = [30 0 90];
    translation = [10 20.5 15];

    Create a rigidtform3d object that performs the specified rotation and translation.

    tform = rigidtform3d(angles,translation)
    tform = 
      rigidtform3d with properties:
    
        Dimensionality: 3
           Translation: [10 20.5000 15]
                     R: [3x3 double]
    
                     A: [     0   -0.8660    0.5000   10.0000
                         1.0000         0         0   20.5000
                              0    0.5000    0.8660   15.0000
                              0         0         0    1.0000]
    
    

    Examine the value of the A property.

    tform.A
    ans = 4×4
    
             0   -0.8660    0.5000   10.0000
        1.0000         0         0   20.5000
             0    0.5000    0.8660   15.0000
             0         0         0    1.0000
    
    

    Extended Capabilities

    Version History

    Introduced in R2022b

    expand all