An affine transformation allows you to match the points on two vector maps that use different coordinate systems so they can be used together. The base map stays the same while the derived map is transformed mathematically to match up coordinates to the base map.
MapInfo Pro provides the definitions for scale, translation, rotation, reflection, and shearing necessary to support an optional affine transformation for any coordinate system definition. You can also define a coordinate system with bounds and/or with an affine transformation. This is described in detail in Accounting for Affine Transformations and Explicit Bounds in Projection Types.
There are several basic types of transformation that can be applied to the base map using an affine transformation. These include scaling, translation, rotation, shearing, and reflection.
The scale factor of a transformation indicates the distance between the fixed points of one map versus the fixed points of the second map. If the only difference between two maps is the scale, the affine transformation of the derived map is only the same map zoomed in or out around a fixed point. The orientations of the lines connecting the points, and the angles between these lines, remain the same. The scaling in the case of the figure below is around the 0,0 point.
The difference between these images is the scale. To create an affine transformation that maps the base image (A) to the derived image (B), change only the scale.
The translation factor of a transformation is when every point on an image follows a parallel path and no rotation takes place.
The difference between these two images is the translation.
The rotation factor of a transformation indicates that the image turns on a particular point. The next figure shows a 25-degree rotation of the map around the 0,0 point.
The difference between these two images is not the scale, because the size of each image is the same. The difference is the rotation of the derived image (B).
The shearing factor of a transformation indicates that one of the coordinates of one image should change proportionally to the other. You can apply a shear transformation either on the x-axis as shown in the next figure or on the y-axis. As you can see the vertical scale of the image has not changed, and the corner of the figure at 0,0 has not moved-but points higher up on the figure are shifted progressively further to the right.
The difference is the shearing of the derived image (B).
The reflection factor of a transformation indicates that the derived image is the mirror image of the base image, that is, all the points in the base image should be reflected across some straight line, such as the x-axis or y-axis. In the figure below, the derived image (B) is the reflection of the base image (A).
The difference between these two images is that the derived image (B) is a reflection of the base image (A) along the x-axis.
Mathematically, an affine transformation in MapInfo Pro has the following form:
x' = Ax + By + C
y' = Dx + Ey + F
In these equations, the base coordinates (x, y) are transformed to produce the derived coordinates (x', y'). The six constants A through F determine the effect of the transformation. We can use the post multiply method for homogenous 2D coordinate systems, which can be considered a matrix operation as follows:
A |
B |
C |
X |
X' |
||
D |
E |
F |
* |
Y |
= |
Y' |
0 |
0 |
1 |
1 |
1 |
where (X,Y) and (X',Y') are as defined above.
To do various types of affine transformations the values of A, B, C, D, E, and F need to be determined. To define the basic transformations that can be done using an affine transformation, determine the translations, rotations, reflections, scaling and shearing in the X and Y directions.
Translation: C and F are the values you want (0, 0) to go to, A=E=1 and B=D=0. To move the coordinate system so the origin is at (5, 2) the values would be: A=1, B=0, C=5, D=0, E=1, and F=2.
Rotation about the origin: A=E=cos(angle to rotate), -B=D=sin(angle to rotate), C=F=0. To rotate 60 degree counterclockwise around the origin, A=.5, B=-.866, C=0, D= .866, E= .5, and F=0.
To scale in the X direction: A is the scale you want to use. E =1 and the rest are 0. So to scale to 3 times the size in the X direction the values would be A=3, B=0, C=0, D=0, E= 1, F=0.
To scale in the Y direction: E is the scale you want to use. A =1 and the rest are 0. So to scale to 5 times the size in the Y direction the values would be A=1, B=0, C=0, D=0, E=5, F=0.
To scale overall just make sure that A and E are equal.
To shear in the X direction: A = E = 1, B is the shear factor and the rest are 0. So for a shear factor of 5 in the X direction (that is, to move a derived point 5 units in the X direction for each Y unit in the base point) use A=1, B=5, C=0, D=0, E=1, F=0.
To shear in the Y direction: A = E = 1, D is the shear factor and the rest are 0. So for a shear factor of 4 in the Y direction, use A=1, B=0, C=0, D=4, E=1, F=0.
To reflect an image across the X axis: A = 1, E = -1 and the rest are 0. More generally, to reflect across the line y = k, use A=1, B=0, C=0, D=0, E=-1, F=2*k.
To reflect an image across the Y axis: A = -1, E = 1 and the rest are 0. More generally, to reflect across the line x = j, use A=-1, B=0, C=2*j, D=0, E=1, F=0.
To get a general affine transformation, do a pre-matrix multiplication of the basic pieces of the transformation. Make sure that you put the first operation on the right. So to Translate to (5,2), rotate 60 degrees and then shear 5 units in Y, set up and multiply the following matrices:
1 |
0 |
0 |
0.5 |
-.0866 |
0 |
1 |
0 |
5 |
||
5 |
1 |
0 |
* |
.0866 |
0.5 |
0 |
* |
0 |
1 |
2 |
0 |
0 |
1 |
0 |
0 |
1 |
0 |
0 |
1 |
Multiplying these out gives the following matrix:
0.5 | -0.866 | 0.768 |
3.366 | -3.83 | 9.17 |
0 | 0 | 1 |
Therefore, the required values are: A=.5, B=-.866, C=0.768, D=3.366, E=-3.83, F=9.17.