Main Content


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

affine2d is not recommended. Use the affinetform2d object instead. For more information, see Compatibility Considerations.


An affine2d object stores information about a 2-D affine geometric transformation using the postmultiply convention, and enables forward and inverse transformations.



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


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


expand all

Forward 2-D affine transformation, specified as a nonsingular 3-by-3 numeric matrix. The matrix T uses the convention:

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

where T has the form:

 [a b 0;
  c d 0;
  e f 1];

The default of T is the identity transformation.

Data Types: double | single

This property is read-only.

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

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 affine2d object that defines a 30 degree rotation in the counterclockwise direction around the origin.

theta = 30;
tform = affine2d([ ...
    cosd(theta) sind(theta) 0;...
    -sind(theta) cosd(theta) 0; ...
    0 0 1])
tform = 
  affine2d with properties:

                 T: [3x3 double]
    Dimensionality: 2

Apply the forward geometric transformation to a point (10,0).

[x,y] = transformPointsForward(tform,10,0)
x = 8.6603
y = 5

Validate the transformation by plotting the original point (in blue) and the transformed point (in red).

axis([0 12 0 12])
axis square

Figure contains an axes object. The axes object contains 2 objects of type line.

Extended Capabilities

Version History

Introduced in R2013a

expand all