0% found this document useful (0 votes)
10 views

unit-5-5

The document discusses geometric transformations in graphics, focusing on three basic types: translation, scaling, and rotation. It explains how these transformations can be mathematically represented and combined, and provides details on how to perform each transformation using specific equations and matrices. Additionally, it highlights the importance of maintaining object positions during transformations and introduces concepts like uniform and differential scaling.

Uploaded by

totaldhamal0123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

unit-5-5

The document discusses geometric transformations in graphics, focusing on three basic types: translation, scaling, and rotation. It explains how these transformations can be mathematically represented and combined, and provides details on how to perform each transformation using specific equations and matrices. Additionally, it highlights the importance of maintaining object positions during transformations and introduces concepts like uniform and differential scaling.

Uploaded by

totaldhamal0123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

4.

GEOMETRIC
TRANSFORMATION
1.SCALING
2.TRANSLATION
3.ROTATION ABOUT ORIGIN
4.ROTATION ABOUT HOMOGENEOUS
COORDINATES 5.SHEARING
BASIC TRANSFORMATION
• There are three basic actions or movements, moving, scaling, and
rotating which are widely used in the graphics application. This
movement are performed through some basic geometry.
• These transformation are performed using geometry, they are
also known as geometry transformation. There are three basic
transformation,

• 1) Translation
• 2) Scaling
• 3) Rotation.
BASIC TRANSFORMATION
BEFORE SHIFTING AFTER SHIFTING
BASIC TRANSFORMATION

BEFORE SCALING AFTER SCALING


BASIC TRANSFORMATION
BEFORE ROTATION AFTER ROTATION

Introduction of Transformations
• Two essential aspects of transformation are given below:
1.Each transformation is a single entity. It can be denoted by a unique
name or symbol.
2.It is possible to combine two transformations, after connecting a single
transformation is obtained, e.g., A is a transformation for translation.
The B transformation performs scaling. The combination of two is C=AB.
So C is obtained by concatenation property.
• There are two complementary points of view for describing object
transformation.
1.Geometric Transformation: The object itself is transformed relative to the
coordinate system or background. The mathematical statement of this
viewpoint is defined by geometric transformations applied to each point of
the object.
2.Coordinate Transformation: The object is held stationary while the
coordinate system is transformed relative to the object. This effect is
attained through the application of coordinate transformations.
An example that helps to distinguish these two viewpoints:

The movement of an automobile against a scenic background we can simulate this by •Moving

the automobile while keeping the background fixed-(Geometric Transformation) •We can keep

the car fixed while moving the background scenery- (Coordinate Transformation) Types of

Transformations:

1.Translation :- It is the straight line movement of an object from one position to another is called
Translation.

2.Scaling :- It is used to alter or change the size of objects. The change is done using scaling
factors.

3.Rotating :- It is moving of an object about an angle. Movement can be anticlockwise or

clockwise. 4.Reflection :- It is also called a mirror image of an object.

5.Shearing :- It is change in the shape of the object. It is also called as deformation.

1.SCALING
• Scaling transformation is used to alter the size of the given object. The alteration of size of the object is
defined by the given factor. The scale factors specify how big or small the object should be after
alteration.

• To alter the size of any object in the horizontal direction the scale factor Sx is used, whereas to alter in the
vertical direction the scale factor Sy is used.

• The scaling transformation is performed simply by multiplying the (x, y) coordinate values by scale factors of
horizontal and vertical directions, that is by Sx and Sy respectively.

• Mathematical representation of transformation of original coordinates (x, y) into scaled transformed


coordinates (x’ , y’) is


• x′= ���� × and �� = ������
To scale a polygon, this transformation is performed on all the vertices of a given polygon. To enlarge or double the size of
the polygon horizontally, the X – coordinates of all the vertices need to be multiplied by 2.

That is in this case the X – scale factor Sx = 2. if we want to reduce the size of the object vertically by half, the Y – coordinates
of all the vertices are multiplied by the Y – scale factor Sy = (1/2). This transformation can be put in the form of a matrix as
follows.
′ ′
• [x �� ] = [x �� ]���� 0
0 ����

Which is equivalent to P’ = P * S

Where P’ is a 1 * 2 row matrix of scaled coordinates, P is again a 1 * 2 row matrix of original coordinates, and s is a
2 * 2 scaling transformation matrix.
Since Sx and Sy are scale factors they are always positive. Also the values of Sx and Sy greater than 1 will enlarge the object
In horizontal or vertical direction respectively whereas their values between 0 and 1 will reduce the object in the respective
direction.

If the values of Sx and Sy are equal to 1, then the scaling matrix will turn into a unit matrix and therefore there will be no
change in the scaled coordinates.

When the object is altered with same scale factor for both the horizontal and vertical direction, i.e. Sx = Sy, the scaling
transformation is known as uniform scaling transformation otherwise it is called differential scaling transformation.

Uniform Scaling Differential Scaling


To perform scaling on an object, the scaling transformation is performed on all the vertices of the object. Here it will be
interesting and important to observe that be doing this, the position of the related object will be changed along the
transformation.

All the graphical applications need to keep the object at its original position or at some prespecified position ( xk, yk) even
after scale transformation.

This scaling transformation relative to a fixed point ( xk, yk) is done by the following set of

equations x’ = xSx + ( xk - xk sx )
y’ = ySy + ( yk – yk Sy )

x’ = xSx + xk ( 1 - xk sx )

y’ = ySy + yk ( 1 – yk Sy )

′ ′
[x �� ] = [x �� ]���� 0
0 ����+ [ xk ( 1 – Sx ) yk ( 1 – Sy )]
Where xk ( 1 – Sx ) and yk ( 1 – Sy ) are constant terms which are added to the original scale transformation .

The above equations will work with the objects which are define by straight lines. But when the objects or shapes like
circles and ellipse are there, the above mentioned equations or matrices will not work.

For scaling this type of object, the scaling transformation is performed on their parameters, for example, on the radius
for a circle and on the semi – major and semi – minor axes for an ellipse.

It is used to alter or change the size of objects. The change is done using scaling factors. There
are two scaling factors, i.e. Sxin x direction Syin y-direction. If the original position is x and y.
Scaling factors are Sx and Sythen the value of coordinates after scaling will be x1 and y1. If the
picture to be enlarged to twice its original size then Sx = Sy =2. If Sxand Sy are not equal then
scaling will occur but it will elongate or distort the picture.

If scaling factors are less than one, then the size of the object will be reduced. If scaling factors
are higher than one, then the size of the object will be enlarged.
If Sxand Syare equal it is also called as Uniform Scaling. If not equal then called as
Differential Scaling. If scaling factors with values less than one will move the object
closer to coordinate origin, while a value higher than one will move coordinate position
farther from origin.

Enlargement: If T1 = , If (x1 y1)is original position and T1is translation vector then (x2 y2) are
coordinated after scaling

The image will be enlarged two times:-


Reduction:

If T1= If (x1 y1) is original position and T1is translation vector, then (x2 y2) are coordinates after scaling.
1.) Object after scaling in X -
Direction

1.) Object after scaling in Y -

Direction
MATRIX FOR SCALING:-
Example: Prove that 2D Scaling transformations are commutative i.e, S1 S2=S2 S1.
Solution: S1 and S2 are scaling
matrices
2.Translation:-
• Translating an object means moving an object from one place to another. Translation of an object is possible in any
one of the following directions:

• 1) Translation of an object in the horizontal direction, that is translation parallel to X – axis,

• 2) Translation of object in the vertical direction, that is translation parallel to Y – axis, and •

3) Translation of object in the horizontal and the vertical directions simultaneously.

• Suppose we want to move a point ( x, y ) in the horizontal direction, that is in a direction parallel to X – axis
by Tx units, then this movement can be obtained by simply adding Tx to X – coordinate.

• The coordinates of points after translation will be

• X’ = x + Tx

• Y’ = y
Similarly, to move a point ( x, y ) in the vertical direction, that is in the direction parallel to Y – axis, Ty is added to
the Y – coordinates value. In this case, the coordinates of translated point will be
x’ = x

y’ = y + Ty

In the above equations, Tx and Ty are translation factors for translating point in the X – Direction and the Y –
Direction respectively.

The general form of translation is

( x’ , y’ ) = ( x + Tx, Y + Ty)

[ x’ y’ ] = [ x y ] = [ Tx TY]

P’ = P + T

Where P’ is a 1 * 2 row matrix of coordinates of the translated point, P is the 1 * 2 row matrix of coordinates of original
point T is also a 1 * 2 row matrix of translation factors.
Where P’ is a 1 * 2 row matrix of coordinates of the translated point, P is the 1 * 2 row matrix of coordinates of original
point T is also a 1 * 2 row matrix of translation factors.
After translation in both X – and Y - direction
BEFORE TRANSLATION

Translation transformation is a rigid – body transformation. A transformation is called a rigid – body


transformation if the Euclidean distance between any two coordinates remains unchanged by the
transformation.

2.Translation
Here also translation is performed on each and every vertex of an object to translate the entire object. After finding all
the new vertices, the object is redrawn by new derived vertices.

Translation of the other object like circle and ellipse is performed by translating their parameter. Ex. Centre point of
for a circle. Translation is performed after scaling is done on the object to put it back on the desired place.

It is the straight line movement of an object from one position to another is called Translation.
Here the object is positioned from one coordinate location to another.

Translation of point:

To translate a point from coordinate position (x, y) to another (x1 y1), we add algebraically the
translation distances Tx and Tyto original coordinate.

X1 = x + tx
Y1 = y + ty The translation pair (Tx,Ty) is called as shift vector.
Translation is a movement of objects without deformation. Every position or point is translated
by the same amount. When the straight line is translated, then it will be drawn using
endpoints.

For translating polygon, each vertex of the polygon is converted to a new position. Similarly,
curved objects are translated. To change the position of the circle or ellipse its center
coordinates are transformed, then the object is drawn using new coordinates.

Let P is a point with coordinates (x, y). It will be translated as (x1 y1).
X’ = x + tx and y’ = y

X’ = x and y’ = y + ty

Tx and Ty are translation factors for translating point in the x – direction


and y – direction respectively.

( x’ y’ ) = ( x + tx, y + ty )
[ x’ y’ ] = [ x y ] + [ tx ty ]
P’ = p + t
TRANSLATION POLYGON

Matrix for Translation:

3.ROTATION ABOUT ORIGIN


Rotation is the most exciting transformation. This transformation moves an object on a circular path about origin.

This transformation requires two major parameters, direction of rotation and angle of rotation. Any given object can
be rotated either in clockwise direction or in anti-clockwise direction by a given angle ��.

Anticlockwise rotation Original Object clockwise rotation Clockwise and anticlockwise

rotation

In the 2 – Dimensional rotation,


The object is rotated around a fixed point – either an origin or a given point ( this point is called rotation point ).

This rotation can also be describe as rotation around an axis which is called rotation axis.

This rotation axis passes through rotation point and is perpendicular to the XY – plan.

Object

Rotation Point

Rotation Axis
Rotation about a point can also be describe as rotation
about rotation axis.
Let us take a point P( x, y ) to be rotated in anticlockwise direction. The point p’( x’, y’ ) is a rotated point, which is the result
of anticlockwise rotation transformation performed on point P(x,y) with ɵ angle relative to origin (0 , 0).
�� is an angle of point P from X – axis according to simple trigonometric principles
x = r cos ��, y = r sin ��

Where r is the length of ���� , or the distance of point P from the origin ( 0, 0 ). And,

P( x’, y’ )

P( x, y )
ɵ

��
O (0, 0)
Anticlockwise rotation of point
X’ = r cos ( ɵ + �� ), y’ = r sin ( ɵ + �� )

X’ = r cos ɵ cos �� - r sin ɵ sin ��


y’ = r cos �� sin ɵ + r sin �� cos ɵ

Now by substituting equation

X’ = x cos ɵ - y sin ɵ

y’ = x sin ɵ + y cos ɵ

In the matrix notation, it can be represented as [ x’ y’

]=[xy] ������ ɵ

sin ɵ

−sin ɵ cos ɵ

P’ = P * Ra
In equation Ra is the rotation transformation matrix for rotating a point P in anticlockwise direction with angle ɵ relative to
origin.

We can derived the equation to rotate a point in clockwise direction by angle ɵ about the origin.
P( x’, y’ ) P( x, y )
O (0, 0)
P( x’, y’ )
��

r
r
r r
ɵ

P( x, y )
��
O (0, 0)

clockwise rotation of point


Here we are rotating point P( x, y ) in opposite direction of that we did in the clockwise rotation. That is how in this angle will
be
ɵ

Rc = ������(−ɵ) ������(−ɵ)
−������ (−ɵ) ������ (−ɵ)

= ������ ɵ −������ ɵ
������ ɵ ������ ɵ

Rc is a rotation transformation matrix to rotate a point in clockwise direction by ɵ


angle relative to the origin.
4.Rotation About Homogeneous Coordinates

The general form of the basic transformation based on equation


P’ = PG1 + G2

Where P’ is a transformed coordinates matrix, P is a coordinates matrix of a point to be transformed, G1 is a 2 * 2 matrix


of transformation factors and G2 is another 1 * 2 row matrix of translation factor.

Here, G1 = �� ��
; a are ,b,c,d are constant which assume different values for different transformation. The values of a, b, c,
�� ��
d are Sx, 0, 0, and Sy, respectively for scaling transformation and that for rotation in anticlockwise direction by angle
ɵ
ɵɵɵɵ
about the origin are cos , sin , -sin , cos , respectively.

And G2 = [ Tx Ty] .

We can say that matrix G1 is a matrix of multiplicative factors where G2 is a matrix of additive factors. If only translation is
the required transformation, G1 is a unit matrix and if no translation is required in the transformation then G2 will be a null
matrix for addition.
Imagine an animation application in which an object is moving, enlarging, and rotating at a time. All these transformation
are performed simultaneously. Not only that, but all these three transformation are performed again and again in
different frames.

Then first the scaling transformation will be performed. Then on scaled images, rotation will be performed and at last,
after these two transformation, translation will be performed. This process is very cumbersome and time consuming for
some application such as animation.

If we have a single matrix which performed all these three transformation simultaneously using a single transformation
that would be more preferred and will accelerate the speed of transformation process too.

To accommodate the process of two transformation matrices G1 and G2 given. We should have introduced additive factors
of matrix G2 in the first matrix G1. This is not possible without adding a row and a column in the present matrix G1.

This addition of a row and a column in G1 will result into mismatch and matrix addition. This is because matrix
multiplication and addition are not possible for a matrix of order 1 * 2 and another of order 3 * 3.

The coordinate matrices are also to be expanded by one more column. This will make all the coordinate matrices to be of
size 1 * 3, and coordinate triple will be denoted by ( Xw, Yw, w ) where w is a newly added element. The triple ( Xw, Yw, w
) is called homogeneous coordinates related to ( x, y ).

��
�� = ��
��
���� = ��
��
The newly generated homogeneous coordinates can be represented as ( WXw, Wyw, w ) where w can assume any non –
negative value. But for convince and simplicity, the value of w is taken as 1band then coordinates will be represented as (
x, y, 1 ) instead ( x, y ).

Let us now rewrite all the matrices derived in the previous section again with homogeneous rows and

columns. Coordinate matrix [ x y 1 ]

matrices are And


Scale transformation matrix
���� �� ��
�� ���� ��
�� �� �� −������ ɵ
������ ɵ �� ��
�� ��
������ ɵ
������ ɵ ��
Rotation transformation ������ ɵ
−������ ɵ ��
−������ ɵ
������ ɵ �� ��
�� ��

Translation transformation
matrix is
�� �� ��
�� �� ��
���� ���� ��

�� �� ��
And the generalized
transformation matrix will
be
�� �� �� ����
���� ��

Where a, b, c, and d constant will take different values for scaling and rotation transformation, depending on the
transformation on hand.
Rotation Relative To An Arbitrary Point
• Rotation discussed in subsection is rotation relative to origin O(0,0). On our display device, this rotation is performed on
lower left corner provided we consider it as an origin. This rotation will not suffice with all the needs and demands of a
variety of different applications,

• The rotation of the hands of a clock. If rotation relative to origin is given to performed then it is possible that the hands of
the clock may go outside the body of the clock or may even go out the device.

• Rotation should be performed about a specific point rather than about the origin. The rotation should be performed about
the point where both the hands of the clock are joining ( pivot point ) rather than coordinates origin O(0,0).
936

12
Rotation about the
936 origin

Rotation about the


point where hands are
joining ( Pivot point)
12
Rotation about the origin may destroy the image
The rotation transformation matrix about any arbitrary or fixed point may be derived with the help of basic rotation
about origin and translation.

This rotation about any arbitrary point or pivot point is derived in three steps of different basic

transformation. STEPS 1:- Translation of pivot point with the object so that the pivot point is moved to the

origin. STEPS 2:- Rotation of the object in a given direction and rotation angle ɵ about origin.

STEPS 3:- Translation of the pivot point back to its original position from the origin. This Transformation is exactly opposite
to the transformation which was performed in Steps 1.

This Steps are shown in figure:-

(xp, yp)
to origin

(a) Original object with a pivot point


(b) Translation of object, so that pivot point moves
The rotation transformation matrix about any arbitrary or fixed point may be derived with the help of basic rotation
about origin and translation.

This Steps are shown in figure:-

(xp, yp)

(c) Rotation of the object about the origin

Rotation about the pivot point


(d) Translation of object, so that pivot point moves
back to its original position
The composite rotation transformation matrix to rotate an object about an arbitrary or a pivot is derived by multiplying
transformation matrices of translation, rotating about the origin and again performing translation.

�� �� �� ��
�� �� −����
−���� ��
������ ɵ
−������ ɵ
�� ������ ɵ
������ ɵ ��
�� �� ��
�� �� �� ��
�� �� ����
���� ��

������ ɵ −������ ɵ �� ������ ɵ


������ ɵ �� ���� �� − ������ ɵ −
���� ������ ɵ ���� �� −
������ ɵ + ���� ������ɵ ��
The rotation transformation matrix to rotate an object about pivot point (Xp, Yp) with ɵ angle in clockwise direction as
shown. For anticlockwise the matrix would be

������ ɵ ������ ɵ ��
− ������ ɵ ������ ɵ ��
���� �� − ������ ɵ + ���� ������ ɵ ���� �� −
������ ɵ − ���� ������ɵ ��

Shearing
• Shearing is a transformation which distorts the shape of an object such that the transformed object looks like a slanted
object of the original one. There are two popular shearing:
• 1) X – Shearing and the
• 2) Y - Shearing

• X – shearing is a transformation which stores all the Y – coordinates values which remains unchanged and X –
coordinates values are distorted by some factor in proportion to its corresponding X – coordinates .

• Y – shearing is a transformation which is opposite to X – shearing. In this shearing, all Y - coordinates values are
distorted whereas X – coordinates values are stored unchanged.

• X – shearing and Y – shearing are in the form of mathematical equation, X – Shearing is

• X’ = X + Shxy, here Shx is a X – Shearing factor


• Y’ = y
And in the matrix form, X – Shear is

�� �� ��
������ �� ��
�� �� ��
a���� �� − ���������������� ��������
������ �� − ���������� ������������
���� x’ = x and y’ = x Shy + y �� ������ ��
mathematical
ly
�� ��
�� ��
�� ��

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy