1.5.1. Geometric Transformations
We are able to change the geometry of each object by changing its size,
position or orientation. These operations are called geometric transformations.
We translate, scale or rotate objects by first translating, scaling or
rotating their vertices and then drawing new
lines between these translated vertices. Like this we get the new object.
Translation
We translate objects in the (x, y) plane to new
positions by adding translation vectors to the coordinates of their vertices.
x' = x + d x
y' = y + d y
In matrix form this is:
As explained above, after having translated the vertices, we draw new lines between these translated vertices for getting the translated object.
Translation in 2DScaling
Objects can be stretched or shrinked by scaling their
vertices. Their coordinates have to be multiplied by the factor sx along the x axis and by the factor
sy along the y axis:
x' = x * s x
y' = y * s y
In matrix form this is:
The next animation part shows the scaling of an object. We don't show you again the two steps (first scaling vertices and then drawing the new object between these new vertices) because you know now that scaling happens in two steps.
Scaling in 2DNotice that the reference point for scaling is the origin. Therefore, scaling is about the origin: The objects are getting smaller and closer to the origin if the scale factors are less than 1, if they are greater than 1, the objects are both larger and further from the origin. (FOLEY et al. 1996, p. 202)
If you want to get more clarity why the object changes position by applying only scaling operations, have a look at the solutions which provide a calculation example of scaling. (Click here for more information)
Rotation
Objects can be rotated by an angle A around the origin.
Positive angles are measured clockwise from x toward y. A rotation is defined
mathematically by:
x' = x * cos(A) - y *
sin(A)
y' = x * sin(A) + y * cos(A)
In matrix
form this is:
As with scaling, rotation is about the origin, that's why objects change also position. (FOLEY et al. 1996, p. 203). To proof this statement make the calculation of an example as it is shown in the popup window above.