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

L4 - II Computer Graphics

This document discusses two-dimensional transformations, including rotation, translation, and combined transformations. It introduces rotation about an arbitrary point and describes translation as repositioning coordinates along a straight line. Combined transformations can be represented by multiplying the corresponding transformation matrices. The document also discusses homogeneous coordinates for representing 2D points as 3D vectors to allow all transformations to be handled as matrix multiplications.

Uploaded by

روابي
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

L4 - II Computer Graphics

This document discusses two-dimensional transformations, including rotation, translation, and combined transformations. It introduces rotation about an arbitrary point and describes translation as repositioning coordinates along a straight line. Combined transformations can be represented by multiplying the corresponding transformation matrices. The document also discusses homogeneous coordinates for representing 2D points as 3D vectors to allow all transformations to be handled as matrix multiplications.

Uploaded by

روابي
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

TWO DIMENSIONAL

TRANSFORMATIONS II
Unit Structure
4.0 Objectives
4.1 Introduction
4.2 Rotation
4.3 Translation
4.4 Rotation about an Arbitrary Point
4.5 Combined Transformation
4.6 Homogeneous Coordinates
4.7 2D Transformations using Homogeneous Coordinates
4.8 Let us sum up
4.9 References and Suggested Reading
4.0 OBJECTIVES
The objective of this chapter is
• To understand 2D rotation transformation.
• To understand 2D translation transformations.
• To understand two dimensional combined transformations.
• To understand homogenous coordinates and 2D
transformation using homogenous coordinates.
• To understand Shear transformations in 2D.
4.1 INTRODUCTION
• This chapter is the extension of the previous chapter in which we will
discuss the rotation transformation about any point. We will also
learn about the translation transformation in which the position of an
object changes. The homogenous coordinates and 2D transformation
using homogenous coordinates will also be explained.
4.2 ROTATION
• In rotation transformation, an object is repositioned along a circular
path in the xy plane. The rotation is performed with certain angle θ,
known as rotation angle. Rotation can be performed in two ways:
about origin or about an arbitrary point called as rotation point or
pivot point.
Rotation about origin:
The pivot point here is the origin. We can obtain transformation
equations for rotating a point (x, y) through an angleθ to obtain final
point as (x’, y’) with the help of figure as
x' = x cosθ – y sinθ y' = x sinθ + y cosθ

𝑐𝑜𝑠𝜃 −𝑠𝑖𝑛𝜃
The transformation matrix for rotation can be written as 𝑅=
𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃
ROTATION ABOUT AN ARBITRARY POINT

It is often required in many applications to rotate an object about an


arbitrary point rather than the origin. Rotation about an arbitrary pivot
point (xr, yr) is shown in the figure below

Rotation about an arbitrary point


• The corresponding equation obtained will be
x'= xt +(x–xt)cosθ–(y–yt)sinθ y'=yt +(x–xt)sinθ+(y–yt)cosθ

• We can see the difference between this rotation transformation from


the previous one .This one contains the additive terms as well as the
multiplicative factors on the coordinate values.
• Let us understand the rotation about an arbitrary point through an
example. Suppose we have to rotate a triangle ABC by 90 degree
about a point (1, -1). The coordinates of the triangle are
A(4,0),B(8,3)and C(6,2).
4.3 TRANSLATION
• The repositioning of the coordinates of an object along a straight line
path is called as translation. The translation transformation is done by
adding translation distance tx and ty to the original coordinate
position (x, y) to obtain new position (x’, y’).
x'= x + tx, y'= y + ty
• The pair (tx, ty) is called as translation vector or shift vector.
• In the matrix form, it can be written as
P'=P+T ,where

𝑡𝑥
• P= 𝑥1 , P’= 𝑥1 , 𝑇=
𝑡𝑦
𝑦1 𝑦1
The figure below shows the translation of an object. Here coordinate
points defining the object are translated and then it is reconstructed.

Figure 4.2 : 2D translation transformation


Check your Progress:

1. Write down transformation matrix for rotation operation at angle 90.

2.Translate a triangle with vertices at original coordinates (10, 20),


(10,10), (20,10) by tx=5, ty=10.
4.5 COMBINED TRANSFORMATION
• A sequence of transformation is said to be as composite or combined
transformations can be represented by product of matrices. The
product is obtained by multiplying the transformation matrices .

• If a transformation of the plane T1 is followed by a second plane


transformation T2, then the result itself may be represented by a
single transformation T which is the composition of T1 and T2 taken
in that order. This is written as T = T1∙T2.
4.5 COMBINED TRANSFORMATION
4.6HOMOGENOUS COORDINATES
• representing 2D coordinates in terms of vectors with two components
turns out to be rather awkward when it comes to carry out
manipulations in computer graphics. Homogenous coordinates allow
us to treat all transformation in the same way, as matrix
multiplications. The consequence is that our 2-vectors become
extended to 3-vectors, with a resulting increase in storage and
processing.
• Homogenous coordinates means that we represent a point (x, y) by
the extended triplet (x, y, w). In general w should be non-zero. Note in
homogenous coordinates (x, y, w) is the same as (x/w, y/w, 1) as is (ax;
ay; aw) where a can be any real number. Points with w=0 are called
points at infinity, and are not frequently used.
4.7 2D TRANSFORMATIONS USING HOMOGENOUS
COORDINATES
• The homogenous coordinates for transformations are as follows: For translation
𝑥′ 1 0 𝑡𝑥 𝑥
𝑦′ = 0 1 𝑡𝑦 . 𝑦
1 0 0 1 1

• For rotation
𝑥′ 𝑐𝑜𝑠𝜃 − 𝑠𝑖𝑛𝜃 0 𝑥
𝑦′ = 𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0 . 𝑦
1 0 0 1 1

• For scaling
𝑥′ 𝑠𝑥 0 0 𝑥
𝑦′ = 0 𝑠𝑦 0 . 𝑦
1 0 0 1 1
Check your progress:

1. Obtain translation matrix for tx=2, ty=3 in homogenous


coordinate system.

2. Obtain scaling matrix for sx=sy=2 in homogenous coordinate system.


4.8 LET US SUM UP
• We learnt the basics of transformation and its use. Then we studied
two dimensional transformation and its types which were translation,
scaling, rotation, reflection and shear. The transformation matrix
corresponding to each transformation operation was also studied.
Homogenous coordinate system and its importance were also
discussed.
4.9 REFERENCES AND SUGGESTED READING
(1) Computer Graphics, Donald Hearn, M P. Baker, PHI.
(8) Procedural elements of Computer Graphics, David F. Rogers,
Tata McGraw Hill.
(9) Computer Graphics, Rajesh K. Maurya, Wiley – India.

You might also like