Main Content


(Not recommended) 3-D affine geometric transformation using postmultiply convention

affine3d is not recommended. Use the affinetform3d object instead. For more information, see Compatibility Considerations.


An affine3d object stores information about a 3-D affine geometric transformation and enables forward and inverse transformations.



tform = affine3d creates an affine3d object with default property settings that correspond to the identity transformation.


tform = affine3d(t) sets the property T as the specified 3-D affine transformation matrix t.


expand all

Forward 3-D affine transformation, specified as a nonsingular 4-by-4 numeric matrix.

The matrix T uses the convention:

[x y z 1] = [u v w 1] * T

where T has the form:

 [a b c 0;
  d e f 0;
  g h i 0;
  j k l 1];

The default of T is the identity transformation.

Data Types: double | single

Describes the dimensionality of the geometric transformation for both input and output points, specified as the value 3.

Object Functions

invertInvert geometric transformation
isRigidDetermine if geometric transformation is rigid transformation
isSimilarityDetermine if geometric transformation is similarity transformation
isTranslationDetermine if geometric transformation is pure translation
outputLimitsFind output spatial limits given input spatial limits
transformPointsForwardApply forward geometric transformation
transformPointsInverseApply inverse geometric transformation


collapse all

Create an affine3d object that scales a 3-D image by a different factor in each dimension.

Sx = 1.2;
Sy = 1.6;
Sz = 2.4;
T = [Sx 0 0 0; 0 Sy 0 0; 0 0 Sz 0; 0 0 0 1];
tform = affine3d(T)
tform = 
  affine3d with properties:

                 T: [4x4 double]
    Dimensionality: 3

Examine the value of the T property.

ans = 4×4

    1.2000         0         0         0
         0    1.6000         0         0
         0         0    2.4000         0
         0         0         0    1.0000

Extended Capabilities

Version History

Introduced in R2013a

expand all