# http://www.uobabylon.edu.iq/eprints/publication_12_9696_1380.pdf

```‫‪Sunday 18 /11/2012‬‬
‫م‪.‬م عالء الدين عباس عبد الحسن‬
Transformation
 Transformation is the backbone of computer graphics,








it enables us to manipulate the shape, size, and location of
the object. It can be used to effect the following changes in
a geometric object:
Change the location
Change the shape
Change the size
Rotate
Copy
Generate a surface from a line
Generate a solid from a surface
Animate the object
Transformation
 Basic transformations are translation, scaling, rotation,
reflection and, shearing. We look at transformations as
ways of moving the points that describe one or more
geometric objects to new locations. Although there are
many transformations that will move a particular point
to a new location, there will almost always be only a
single way to transform a collection of points to new
locations while preserving the spatial relationships
among them. Hence, although we can find many
matrices that will move one corner of our color cube
from P0 to Q0, only one of them, when applied to all the
vertices of the cube, will result in a displaced cube of
the same size and orientation.
Transformation
1.
Translation
 Translation is an operation that displaces points by a
fixed distance in a given direction. To specify a
translation we need only to specify a displacement
vector d, because the transformed points are given by:
p2=p1+d
 This equation can be written is a scalar form as:
x2=x1+dx
and y2=y1+dy
 In matrix form, the translation is expressed as:
Transformation
 The translation matrix is given by:
 This method of representing translation using the addition
of column matrices does not combine well with our
representations of other affine transformations. However,
we can also get this result using the matrix multiplication:
p' = TP, where
𝑥
1 0 𝑑𝑥
 𝑇 = 0 1 𝑑𝑦
,
𝑃= 𝑦
1
0 0 1
Transformation
 And for 3D transformation we have:
𝒙
𝒚
, 𝑷= 𝒛
𝟏
We can obtain the inverse of a translation matrix either
by applying an inversion algorithm or by noting that if
we displace a point by the vector d, we can return to the
original position by a displacement of( - d )
Transformation
 By either method, we find that
Transformation
2.
Scaling :
 In scaling transformation, the original coordinates of
an object are multiplied by the given scale factor.
There are two types of scaling transformations:
uniform and non-uniform. In the uniform scaling, the
coordinate values change uniformly along the x and y
coordinates, whereas, in non-uniform scaling, the
change is not necessarily the same in all the coordinate
directions.
Transformation
Uniform Scaling
For uniform scaling, the scaling transformation matrix is
given as:
a.
Where s is the scaling vector.
Transformation
b. Non-uniform Scaling
 Matrix equation of a non-uniform scaling has the form :
 P'=SP
𝑥
𝑆𝑥 0 0
𝑥′
 𝑦′ = 0 𝑆𝑦 0 ∗ 𝑦
1
0
0 1
1
 Where sx and sy are the scale factors for the x and y
coordinates of the object.
Transformation
 There is a fixed point that is unchanged by the
transformation. We let the fixed point be the origin,
and we show how we can concatenate transformations
to obtain the transformation for an arbitrary fixed
point. A scaling matrix with a fixed point of the origin
allows for independent scaling along the coordinate
axes.
Transformation
 The three equations are
 These three equations can be combined in
homogeneous form as
Transformation
 We obtain the inverse of a scaling matrix by applying
the reciprocals of the scale factors:
 Note : Invers of Scale is
S-1
=
1
𝑆
Transformation
3.





Scaling about an arbitrary point :
If we want to scale an object about a fixed point we
have to walk through the following algorithm :
Step1 : Translate the object to the origin.
Step2 : Scale the object by given Scale factor.
Step3 : Translate the object back to the original
position.
These three steps can be combine with transformation
matrix as below:
Transformation
1
𝑇1 = 0
0
𝑆𝑥
𝑆2 = 0
0
1
𝑇3 = 0
0
0 −𝑑𝑥
1 −𝑑𝑦
0
1
0 0
𝑆𝑦 0
0 1
0 𝑑𝑥
1 𝑑𝑦
0 1
Transformation
 Exercise : give the result of the following matrices
multiplication.
T
FixPointScale
𝑆𝑥 0 0
1 0 𝑑𝑥
1 0
= 0 1 𝑑𝑦 ∗ 0 𝑆𝑦 0 ∗ 0 1
0
0 1
0 0 1
0 0
−𝑑𝑥
−𝑑𝑦
1
```