Lecture -01
1. Transformation
2. 2D Translation
3. 2D Rotation
4. 2D Scaling
Transformation
Introduction
The term Transformation is generally referred to as converting a graphic into another graphic by
applying some rules or algorithms. Sometimes an image or picture can be a combination of lines,
rectangle, circle, and triangle. If we draw the basic and combination of pictures, then there
should be a need to transform these images. Now we can perform the following actions to
transform the images-
We can change the position of an image.
We can increase or decrease the size of an image.
We can change the angle of the image.
By using the above actions, we will find a new image; this process is called Transformation. We
can use some algorithms to produce new pictures.
The object transformation includes two important points-
Geometric Transformation: When we are moving the picture, and the background is
fixed, then it is a Geometric Transformation.
Coordinate Transformation: When we are moving the background, and the picture is
fixed, then it is Coordinate Transformation.
Types of Transformation
There are two basic kinds of Translation.
1.Two-Dimensional(2D) Transformation:
“When we translate, rotate, and scale object in the two-dimensional plane, then it is called
a Two-Dimensional Transformation.” A two-dimensional plane consists of the x and y-axis.
The Two-Dimensional Transformation includes-
2D Translation: “Translation is a mechanism used to move the object from one position
to another position on the screen.”
2D Rotation: “Rotation is a process used to rotate the object from origin to a particular
angle.”
2D Scaling: “Scaling is a process or technique used to resize the object in two-
dimensional plane.”
2D Reflection: “Reflection is a mechanism or process in which we can rotate the object
at the angle of 180°”.
2D Shearing: “Shearing is a process that is used to perform slanting on the object.” It is
also called “Skewing.”
2.Three-Dimensional Transformation:
“When we translate, rotate, and scale object in the three-dimensional plane then, it is
called Three-Dimensional(3D) Transformation”. A three-dimensional plane consists of x, y,
and z-axis.
The Three-Dimensional Transformation includes-
3D Translation: “Translation is a mechanism used to move the object from one position
to another position on the three-dimensional plane.”
3D Rotation: “Rotation is a process used to rotate the object from origin to a particular
angle in three-dimensional plane.”
3D Scaling: “Scaling is a process or technique used to resize the object in three-
dimensional plane”.
3D Reflection: “Reflection is a mechanism or process in which we can rotate the object
at the angle of 180° in three-dimensional plane.”
3D Shearing: “Shearing is a process that is used to perform slanting on the object.” It is
also called “Skewing”. It also includes z-axis.
2D Translation
We can move any object from one to another place without changing the shape of the
object.
For Example-
Translation of a Point:If we want to translate a point from P (x0, y0) to Q (x1, y1), then
we have to add Translation coordinates (Tx, Ty) with original coordinates.
We can also represent the translation in matrix form-
We can apply Translation on following objects-
Line
Rectangle
Polygon
Square
Homogeneous Coordinate Representation:
The above Translation is also shown in the form of 3 x 3 matrix-
Here, Translation coordinates (Tx, Ty) are also called “Translation or Shift Vector.”
Example- Given a Point with coordinates (2, 4). Apply the translation with distance 4
towards x-axis and 2 towards the y-axis. Find the new coordinates without changing the
radius?
Solution: P = (x0, y0) = (2,4)
Shift Vector = (Tx, Ty) = (4, 2)
Let us assume the new coordinates of P = (x1, y1)
Now we are going to add translation vector and given coordinates, then
x1 = x0 + Tx = (2 + 4) = 6
y1 = y0 + Ty = (4 + 2) = 6
Thus, the new coordinates = (6,6)
2D Rotation
The Rotation of any object depends upon the two points.
Rotation Point: It is also called the Pivot point.
Rotation Angle: It is denoted by Theta ( ).
We can rotate an object in two ways-
Clockwise: An object rotates clockwise if the value of the Rotation angle is
negative (-).
Anti-Clockwise: An object rotates anti-clockwise if the value of the Rotation
angle is positive (+).
We can apply Rotation on following objects-
Straight Lines
Curved Lines
Polygon
Circle
For Example-
Rotation of a Point: If we want to Rotate a point A (P0, Q0) that has a Rotation
angle with distance r from origin to A` (P1, Q1) that has a Rotation angle
. Then, we can rotate by following Rotation equation-
We can represent the coordinates of point A (P0, Q0) by using standard
trigonometry-
We can also define point A` (P1, Q1) in the same way-
By using equation (1) (2) (3) (4), we will get-
We can also represent the Rotation in the form of matrix-
Homogeneous Coordinates Representation: The Rotation can also be
represented in the form of 3 x 3 Rotation matrix-
Example- A line segment with the starting point (0, 0) and ending points (5, 5).
Apply 30-degree rotation anticlockwise direction on the line. Find the new
coordinates of the line?
Solution- We can rotate the straight line by its endpoints with the same angle.
We have,
(P0, Q0) = (0, 0)
Rotation Angle () = 30°
Let the new coordinates of line = (P1, Q1)
We can apply the rotation matrix, then,
Thus, the new endpoint coordinates of the line are = (P1, Q1) = (1.83, 6.83)
2D Scaling
In scaling, we can expend or compress the size of any object. We can apply scaling on
the object by multiplying the original coordinates with scaling factors.
The term scaling factor is used to define whether the size of an object is increased or
decreased. We can represent the scaling factor by ‘Sx’ for the x- axis and ‘Sy’ for the y-
axis.
For Example- If we want to scale an object that has R (P0, Q0) coordinate and the new
coordinates of an object are R` (P1, Q1) then the equation will be-
P1 = P0. Sx
Q1 = Q0. Sy
We can also represent Scaling in the form of Matrix-
Homogeneous Coordinates Representation: The scaling is also represented in the form
of 3 x 3 matrix-
Example: A Square object with the coordinate points P (1, 4), Q (4, 4), R (4, 1), T (1,1).
Apply the scaling factor 3 on the X-axis and 4 on the Y-axis. Find out the new
coordinates of the square?
Solution: We have,
Coordinates Points for Square = P (1, 4), Q (4, 4), R (4, 1), S (1, 1)
Scaling factor along with X axis (Sx) = 3
Scaling factor along with Y axis (Sy)= 4
Applying the equation to find the new coordinates-
For Coordinate P (1, 4)-
Let the new Coordinate for P = (P1, Q1)
P1 = P0. Sx = 1 x 3 = 3
Q1 = Q0. Sy = 4 x 4 = 16
The new Coordinates = (3, 16)
For Coordinate Q (4, 4)-
Let the new Coordinate for Q = (P,1 Q1)
P1 = P0. Sx = 4 x 3 = 12
Q1 = Q0. Sy = 4 x 4 = 16
The new Coordinates = (12, 16)
For Coordinate R (4, 1)-
Let the new Coordinate for R = (P1, Q1)
P1 = P0. Sx = 4 x 3 = 12
Q1 = Q0. Sy = 1 x 4 = 4
The new Coordinates = (12, 4)
For Coordinate S (1, 1)-
Let the new Coordinate for S = (P1, Q1)
P1 = P0. Sx = 1 x 3 = 3
Q1 = Q0. Sy = 1 x 4 = 4
The new Coordinates = (3, 4)
Thus, the new coordinates for square after scaling = P (3, 16), Q (12, 16), R (12, 4), S (3,
4).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
NUBTK