This document is archived and information here might be outdated. Recommended version. |
A two dimensional affine transformation.
The AffineTransformation2D coclass offers the ability to construct custom
transformations for geometrical shapes. It is useful for creating
particular transformations that are not supported by ITransform2D and
also for performing numerous transformations in one go.
Transformations can be done in two different ways. Firstly, and most
commonly within the geometry model, the AffineTransformation2D
object can be used in the ITransform2D::Transform method to transform
an existing Geometry. Alternatively, the methods of ITransform can
be used to transform points or values individually.
AffineTransformation2D implements two types of transformation.
Conformal Transformation (IAffineTransformation2D3::DefineConformalFromControlPoints)
and Affine Tranformation (IAffineTransformation2D::DefineFromControlPoints).
CONFORMAL TRANSFORMATION
At least two points are required to define this transformation.
The CONFORMAL equations use 4 parameters.
MATHEMATICAL MODEL :
The transformation can be described by a set of ceofficients (a, b, c, d, e, f)
of two linear equations:
X = ax + by + c
Y = -bx + ay + f
or in matrix form:
a |
b |
0 |
||||||||||||||
X |
Y |
1 |
= |
x |
y |
1 |
-b |
a |
0 |
|||||||
c |
d |
1 |
The transformation elements can be interpreted as a sequence of simple operations:
Scaling * Rotation * Translation =
Sx |
0 |
0 |
cos r |
sin r |
0 |
1 |
0 |
0 |
||||||||||||||
x |
y |
1 |
0 |
Sy |
0 |
-sin r |
cos r |
0 |
0 |
1 |
0 |
|||||||||||
0 |
0 |
1 |
0 |
0 |
1 |
Dx |
Dy |
1 |
Where :
S - scaling factors (can be negative)
r - rotation angle in radians, measured counter-clockwise from x-
axis (-pi < r <= pi)
Dx, Dy - translation distances in x and y direction
These elements have the following locations within the transformation
matrix by which a ROW vector {x, y, 1} is to be POST-multiplied.
Given the matrix above the equation parameters can be interpreted as :
a = S cos r
b = S sin r
c = Dx
d = Dy
AFFINE TRANSFORMATION
At least three points are required to define this transformation.
The AFFINE equations use six parameters.
MATHEMATICAL MODEL :
The transformation can be described by a set of ceofficients (a, b, c, d, e, f)
of two linear equations:
X = a * x + b * y + c
Y = d * x + e * y + f
or in matrix form:
a |
d |
0 |
||||||||||||||
X |
Y |
1 |
= |
x |
y |
1 |
b |
e |
0 |
|||||||
c |
f |
1 |
The transformation elements can be interpreted as a sequence of simple operations:
Scaling * Shearing * Rotation * Translation =
Sx |
0 |
1 |
1 |
0 |
0 |
cos r |
sin r |
0 |
1 |
0 |
0 |
|||||||||||||||||
x |
y |
1 |
0 |
Sy |
0 |
tan s |
1 |
0 |
-sin r |
cos r |
0 |
0 |
1 |
0 |
||||||||||||||
0 |
0 |
1 |
0 |
0 |
1 |
0 |
0 |
1 |
Dx |
Dy |
1 |
Where :
Sx, Sy - scaling factors (can be negative)
s - skew angle of shearing along x-axis, measured from y-axis (-pi/2 < s < pi/2)
r - rotation angle in radians, measured counter-clockwise from x-axis (-pi < r <= pi)
Dx, Dy - translation distances in x and y direction (can be negative)
These elements have the following locations within the transformation matrix by which a ROW vector {x, y, 1} is to be POST-multiplied.
Sx * cos r |
Sx * sin r |
0 |
||
(Sy / cos s) * sin (s - r) |
(Sy / cos s) * cos (s - r) |
0 |
||
Dx |
Dy |
1 |
Given the matrix above the equation parameters can be interpreted as :
a = Sx cos r
b = (Sy / cos s) sin(s - r)
c = Dx
d = Sx sin r
e = (Sy / cos s) cos(s - r)
f = Dy
Use the ISupportErrorInfo method InterfaceSupportsErrorInfo to determine if the object supports extended error information. If the object supports extended error info, VC++ developers should use the OLE/COM IErrorInfo interface to access the ErrorInfo object. Visual Basic developers should use the global error object Err to retrieve this extended error information.
Interfaces | Description |
---|---|
IAffineTransformation2D | Provides access to members that define and manipulate affine transformations. |
IAffineTransformation2D2 | Provides access to members that define and manipulate affine transformations. |
IAffineTransformation2D3 | Provides access to members that define and manipulate affine transformations. |
IAffineTransformation2D3GEN | Provides access to members that define and manipulate affine transformations. IAffineTransformation2D3GEN is generic version of IAffineTransformation2D3 |
IClone (esriSystem) | Provides access to members that control cloning of objects. |
ISupportErrorInfo (esriSystem) | |
ITransformation | Provides access to members that apply a function (or its inverse) to a set of points or measures. The suffix of each method indicates the type of parameters operated on. |
ITransformationGEN | Provides access to members that apply a function (or its inverse) to a set of points or measures. The suffix of each method indicates the type of parameters operated on. ITransformationGEN is generic version of ITransformation. |
IZShift | Provides access to a limited 3D awareness for a 2D affine transformation. |
The skew angle is not public yet and cannot be directly get by using a method. But this angle can be calculated by first retrieveing some of the other parameters (b, d, r).
s = atan (b/d) + r
At 8.1, AffineTransformation2D does not implement the following methods:
IClone::Assign
IClone::IsEqual
IClone::IsIdentical
ITransformation::TransformMeasuresFF
ITransformation::TransformMeasuresFI
ITransformation::TransformMeasuresIF
ITransformation::TransformMeasuresII
ITransformation::TransformPointsIF
ITransformation::TransformPointsII
All of these methods return an HRESULT of E_NOTIMPL in C++. In VB, this is Error 445, "Object doesn't support this action".