In Euclidean geometry, an affine transformation or affinity (from the Latin, affinis, "connected with") is a geometric transformation that preserves lines and parallelism, but not necessarily Euclidean distances and angles.
More generally, an affine transformation is an automorphism of an affine space (Euclidean spaces are specific affine spaces), that is, a function which maps an affine space onto itself while preserving both the dimension of any affine subspaces (meaning that it sends points to points, lines to lines, planes to planes, and so on) and the ratios of the lengths of parallel line segments. Consequently, sets of parallel affine subspaces remain parallel after an affine transformation. An affine transformation does not necessarily preserve angles between lines or distances between points, though it does preserve ratios of distances between points lying on a straight line.
If is the point set of an affine space, then every affine transformation on can be represented as the composition of a linear transformation on and a translation of . Unlike a purely linear transformation, an affine transformation need not preserve the origin of the affine space. Thus, every linear transformation is affine, but not every affine transformation is linear.
Examples of affine transformations include translation, scaling, homothety, similarity, reflection, rotation, shear mapping, and compositions of them in any combination and sequence.
Viewing an affine space as the complement of a hyperplane at infinity of a projective space, the affine transformations are the projective transformations of that projective space that leave the hyperplane at infinity invariant, restricted to the complement of that hyperplane.
A generalization of an affine transformation is an affine map (or affine homomorphism or affine mapping) between two (potentially different) affine spaces over the same field . Let and be two affine spaces with and the point sets and and the respective associated vector spaces over the field . A map is an affine map if there exists a linear map such that for all in .
Let be an affine space over a field, and be its associated vector space. An affine transformation is a bijection from onto itself that is an affine map; this means that a linear map from to is well defined by the equation
g(y-x)=f(y)-f(x);
y-x=y'-x'
f(y)-f(x)=f(y')-f(x').
If the dimension of is at least two, a semiaffine transformation of is a bijection from onto itself satisfying:
These two conditions are satisfied by affine transformations, and express what is precisely meant by the expression that " preserves parallelism".
These conditions are not independent as the second follows from the first. Furthermore, if the field has at least three elements, the first condition can be simplified to: is a collineation, that is, it maps lines to lines.
By the definition of an affine space, acts on, so that, for every pair
(x,v)
\vec{v}(x)=y
\vec{v}=bf{v}
-1 | |
m | |
c |
(bf{v})=\vec{v}(c)
x+y=
-1 | |
m | |
c |
\left(mc(x)+mc(y)\right),forallx,yinX,
rx=
-1 | |
m | |
c |
\left(rmc(x)\right),forallrinkandxinX.
For any linear transformation of, we can define the function by
L(c,λ)(x)=
-1 | |
m | |
c |
\left(λ(mc(x))\right)=c+λ(\vec{cx}).
Then is an affine transformation of which leaves the point fixed. It is a linear transformation of, viewed as a vector space with origin .
Let be any affine transformation of . Pick a point in and consider the translation of by the vector
\bold{w}=\overrightarrow{c\sigma(c)}
\sigma(x)=T\bold{w
This representation of affine transformations is often taken as the definition of an affine transformation (with the choice of origin being implicit).
As shown above, an affine map is the composition of two functions: a translation and a linear map. Ordinary vector algebra uses matrix multiplication to represent linear maps, and vector addition to represent translations. Formally, in the finite-dimensional case, if the linear map is represented as a multiplication by an invertible matrix
A
b
f
x
y=f(x)=Ax+b.
Using an augmented matrix and an augmented vector, it is possible to represent both the translation and the linear map using a single matrix multiplication. The technique requires that all vectors be augmented with a "1" at the end, and all matrices be augmented with an extra row of zeros at the bottom, an extra column—the translation vector—to the right, and a "1" in the lower right corner. If
A
\begin{bmatrix}y\ 1\end{bmatrix} =\left[\begin{array}{ccc|c}&A&&b\ 0& … &0&1\end{array}\right] \begin{bmatrix}x\ 1\end{bmatrix}
is equivalent to the following
y=Ax+b.
The above-mentioned augmented matrix is called an affine transformation matrix. In the general case, when the last row vector is not restricted to be
\left[\begin{array}{ccc|c}0& … &0&1\end{array}\right]
This representation exhibits the set of all invertible affine transformations as the semidirect product of
Kn
\operatorname{GL}(n,K)
Ordinary matrix-vector multiplication always maps the origin to the origin, and could therefore never represent a translation, in which the origin must necessarily be mapped to some other point. By appending the additional coordinate "1" to every vector, one essentially considers the space to be mapped as a subset of a space with an additional dimension. In that space, the original space occupies the subset in which the additional coordinate is 1. Thus the origin of the original space can be found at
(0,0,...c,0,1)
The advantage of using homogeneous coordinates is that one can combine any number of affine transformations into one by multiplying the respective matrices. This property is used extensively in computer graphics, computer vision and robotics.
Suppose you have three points that define a non-degenerate triangle in a plane, or four points that define a non-degenerate tetrahedron in 3-dimensional space, or generally points, ..., that define a non-degenerate simplex in -dimensional space. Suppose you have corresponding destination points, ...,, where these new points can lie in a space with any number of dimensions. (Furthermore, the new points need not be distinct from each other and need not form a non-degenerate simplex.) The unique augmented matrix that achieves the affine transformationis
An affine transformation preserves:
p1
p2
p3
p4
\overrightarrow{p1p2}
\overrightarrow{p3p4}
\overrightarrow{f(p1)f(p2)}
\overrightarrow{f(p3)f(p4)}
A
\left[\begin{array}{ccc|c}&A-1&&-A-1\vec{b} \ 0&\ldots&0&1\end{array}\right].
The invertible affine transformations (of an affine space onto itself) form the affine group, which has the general linear group of degree
n
n+1
The similarity transformations form the subgroup where
A
A
Each of these groups has a subgroup of orientation-preserving or positive affine transformations: those where the determinant of
A
If there is a fixed point, we can take that as the origin, and the affine transformation reduces to a linear transformation. This may make it easier to classify and understand the transformation. For example, describing a transformation as a rotation by a certain angle with respect to a certain axis may give a clearer idea of the overall behavior of the transformation than describing it as a combination of a translation and a rotation. However, this depends on application and context.
An affine map
f\colonl{A}\tol{B}
f
\varphi
P,Q\inl{A}
\overrightarrow{f(P)~f(Q)}=\varphi(\overrightarrow{PQ})
f(Q)-f(P)=\varphi(Q-P)
We can interpret this definition in a few other ways, as follows.
If an origin
O\inl{A}
B
f(O)\inl{B}
\vec{x}
f\colon(O+\vec{x})\mapsto(B+\varphi(\vec{x}))
If an origin
O'\inl{B}
g\colonl{A}\tol{B}
O\mapstoO'
g\colon(O+\vec{x})\mapsto(O'+\varphi(\vec{x}))
followed by the translation by a vector
\vec{b}=\overrightarrow{O'B}
The conclusion is that, intuitively,
f
Given two affine spaces
l{A}
l{B}
f\colonl{A}\tol{B}
\{(ai,λi)\}i\in
l{A}
\sumi\inλi=1
we have[3]
f\left(\sumi\inλiai\right)=\sumi\inλif(ai)
In other words,
f
The word "affine" as a mathematical term is defined in connection with tangents to curves in Euler's 1748 Introductio in analysin infinitorum.[4] Felix Klein attributes the term "affine transformation" to Möbius and Gauss.
In their applications to digital image processing, the affine transformations are analogous to printing on a sheet of rubber and stretching the sheet's edges parallel to the plane. This transform relocates pixels requiring intensity interpolation to approximate the value of moved pixels, bicubic interpolation is the standard for image transformations in image processing applications. Affine transformations scale, rotate, translate, mirror and shear images as shown in the following examples:[5]
Transformation name | Affine matrix | Example | |
---|---|---|---|
Identity (transform to original image) | \begin{bmatrix} 1&0&0\\ 0&1&0\\ 0&0&1 \end{bmatrix} | < | -- align="center", because the images depict the coordinate origin (concerning the matrices) in the center. --> |
Translation | \begin{bmatrix} 1&0&vx>0\\ 0&1&vy=0\\ 0&0&1 \end{bmatrix} | < | -- There is no image for translation. align="right" works, because the image for scaling makes the column wide enough. --> |
Reflection | \begin{bmatrix} -1&0&0\\ 0&1&0\ 0&0&1 \end{bmatrix} | ||
Scale | \begin{bmatrix} cx=2&0&0\\ 0&cy=1&0\ 0&0&1 \end{bmatrix} | ||
Rotate | \begin{bmatrix} \cos(\theta)&-\sin(\theta)&0\\ \sin(\theta)&\cos(\theta)&0\ 0&0&1 \end{bmatrix} | where | |
Shear | \begin{bmatrix} 1&cx=0.5&0\\ cy=0&1&0\ 0&0&1 \end{bmatrix} | ||
The affine transforms are applicable to the registration process where two or more images are aligned (registered). An example of image registration is the generation of panoramic images that are the product of multiple images stitched together.
The affine transform preserves parallel lines. However, the stretching and shearing transformations warp shapes, as the following example shows:
This is an example of image warping. However, the affine transformations do not facilitate projection onto a curved surface or radial distortions.
Affine transformations in two real dimensions include:
To visualise the general affine transformation of the Euclidean plane, take labelled parallelograms ABCD and A′B′C′D′. Whatever the choices of points, there is an affine transformation T of the plane taking A to A′, and each vertex similarly. Supposing we exclude the degenerate case where ABCD has zero area, there is a unique such affine transformation T. Drawing out a whole grid of parallelograms based on ABCD, the image T(P) of any point P is determined by noting that T(A) = A′, T applied to the line segment AB is A′B′, T applied to the line segment AC is A′C′, and T respects scalar multiples of vectors based at A. [If ''A'', ''E'', ''F'' are collinear then the ratio length(''AF'')/length(''AE'') is equal to length(''A''′''F''′)/length(''A''′''E''′).] Geometrically T transforms the grid based on ABCD to that based in A′B′C′D′.
Affine transformations do not respect lengths or angles; they multiply area by a constant factor
area of A′B′C′D′ / area of ABCD.
A given T may either be direct (respect orientation), or indirect (reverse orientation), and this may be determined by its effect on signed areas (as defined, for example, by the cross product of vectors).
The functions
f\colon\R\to\R, f(x)=mx+c
m
c
\R
m\ne0
In
R2
\begin{bmatrix}x\ y\end{bmatrix}\mapsto\begin{bmatrix}0&1\ 2&1\end{bmatrix}\begin{bmatrix}x\ y\end{bmatrix}+\begin{bmatrix}-100\ -100\end{bmatrix}
Transforming the three corner points of the original triangle (in red) gives three new points which form the new triangle (in blue). This transformation skews and translates the original triangle.
In fact, all triangles are related to one another by affine transformations. This is also true for all parallelograms, but not for all quadrilaterals.