Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Computer graphics

Rating
-
Sold
-
Pages
39
Uploaded on
23-03-2024
Written in
2023/2024

In this document you can find a lot of topics regarding to computer graphics subject

Institution
Course

Content preview

Unit 2
Two-Dimensional Geometric Transformations
Changing co-ordinate description of an object is called transformation.
Types:
- Rigid body transformation (transformation without change in shape.)
- Non rigid body transformation (transformation with change in shape.)

 When a transformation takes place on a 2D plane, it is called 2D transformation.
 The three basic transformations are
 Translation
 Rotation
 Scaling
Other transformation includes reflection and shear.


 2D Translation

Repositioning of object along a straight-line path from one coordinate location to another is
called translation.
Translation is performed on a point by adding offset to its coordinate so as to generate a new
coordinate position.
Let p(x, y) be translated to 𝑝′(𝑥′, 𝑦′) by using offset 𝑡𝑥 and 𝑡𝑦 in x & y direction. Then,
𝑥′=𝑥 + 𝑡𝑥
𝑦′=𝑦 + 𝑡𝑦 𝑝′(𝑥′, 𝑦′)
In matrix form,
𝑇
i.e. 𝑃′ = 𝑃 + 𝑇 where T is transformation matrix.


 2D Rotation

- Changing the co-ordinate position along a circular path is called rotation.

2D rotation is applied to re-position the object along a circular path in XY-plane. Rotation is
generated by specifying rotation angle (𝜃) and pivot point (rotation point).
 The positive 𝜃 rotates object in anti-clockwise direction and the negative value of 𝜃
rotates the object in clockwise direction.
Let 𝑝(𝑥, 𝑦) be a point rotated by 𝜃 about origin to new point 𝑝′(𝑥′, 𝑦′).
Here, y
𝑥 = 𝑟𝑐𝑜𝑠(∅ + 𝜃)

𝑝′(𝑥′, 𝑦′)
= 𝑟𝑐𝑜𝑠∅𝑐𝑜𝑠𝜃 − 𝑟𝑠𝑖𝑛∅𝑠𝑖𝑛𝜃
𝑝(𝑥, 𝑦)
r
But 𝑥 = 𝑟𝑐𝑜𝑠∅ & 𝑦 = 𝑟𝑠𝑖𝑛∅ 𝜃
∴ 𝒙′ = 𝒙𝒄𝒐𝒔𝜽 − 𝒚𝒔𝒊𝒏𝜽................(i) ∅
x
Similarly,
∴ 𝒚′ = 𝒙𝒔𝒊𝒏𝜽 + 𝒚𝒄𝒐𝒔𝜽.................(ii)

,Which are equation for rotation of (x, y) with angle 𝜃 and taking pivot as origin.

In matrix form
𝑃′ = 𝑅. 𝑃
𝑥′ 𝑐𝑜𝑠𝜃 −𝑠𝑖𝑛𝜃 𝑥
[ ]=[ ][ ]
𝑦′ 𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 𝑦

If the pivot point is at(𝒙𝒓, 𝒚𝒓).




Here,

cos(∅ + 𝜃) = (𝑥′ − 𝑥𝑟)/𝑟
or, 𝑟 cos(∅ + 𝜃) = (𝑥′ − 𝑥𝑟)
or, (𝑥′ − 𝑥𝑟) = 𝑟𝑐𝑜𝑠∅𝑐𝑜𝑠𝜃 − 𝑟𝑠𝑖𝑛∅𝑠𝑖𝑛𝜃

Since, 𝑟𝑐𝑜𝑠∅ = (𝑥 − 𝑥𝑟), 𝑟𝑠𝑖𝑛∅ = (𝑦 − 𝑦𝑟)

∴ 𝒙′ = 𝒙𝒓 + (𝒙 − 𝒙𝒓)𝒄𝒐𝒔𝜽 − (𝒚 − 𝒚𝒓)𝒔𝒊𝒏𝜽 ……… (i)
Similarly,

sin(∅ + 𝜃) = (𝑦′ − 𝑦𝑟)/𝑟
or, 𝑟 s 𝑖𝑛(∅ + 𝜃) = (𝑦′ − 𝑦𝑟)
or, (𝑦′ − 𝑦𝑟) = 𝑟𝑠𝑖𝑛∅𝑐𝑜𝑠𝜃 + 𝑟𝑐𝑜𝑠∅𝑠𝑖𝑛𝜃

Since, 𝑟𝑐𝑜𝑠∅ = (𝑥 − 𝑥𝑟), 𝑟𝑠𝑖𝑛∅ = (𝑦 − 𝑦𝑟)

∴ 𝒚′ = 𝒚𝒓 + (𝒙 − 𝒙𝒓)𝒔𝒊𝒏𝜽 + (𝒚 − 𝒚𝒓)𝒄𝒐𝒔𝜽 ……… (ii)
These equations (i) and (ii) are the equations for rotation of a point (x, y) with angle 𝜃 taking
pivot point(xr, yr).


 2D Scaling

Scaling transformation alters the size of object. A simple two dimensional scaling operation
is performed by multiplying object position (x, y) with scaling factors 𝑠𝑥 & 𝑠𝑦 along x & y
direction to produce (𝑥′, 𝑦′).
𝑥′ = 𝑥. 𝑠𝑥 & 𝑦′ = 𝑦. 𝑠𝑦
In matrix form,
𝑃′ = 𝑆. 𝑃

,𝑥 𝑥

, 𝑥′ 𝑠𝑥 0 𝑥
[ ′] = [ ][ ]
𝑦 0 𝑠𝑦 𝑦
If the scaling factor is less than 1, the size of object is decreased and if it is greater than 1
the size of object is increased. The scaling factor = 1 for both direction does not change the
size of the object.
 If both scaling factors have same value then the scaling is known as uniform scaling.
 If the value of 𝑠𝑥 and 𝑠𝑦 are different, then the scaling is known as differential scaling.
The differential scaling is mostly used in the graphical package to change the shape of
the object.

 If fixed point is (𝑥𝑓, 𝑦𝑓) about which rotation is made, then
𝑥′ = 𝑥. 𝑠𝑥 + 𝑥𝑓(1 − 𝑠𝑥)
𝑦′ = 𝑦. 𝑠𝑦 + 𝑦𝑓(1 − 𝑠𝑦)




 Matrix representation & Homogenous coordinate

The homogeneous co-ordinate system provides a uniform framework for handling different
geometric transformations, simply as multiplication of matrices.
To perform more than one transformation at a time, homogeneous coordinates are used.
They reduce unwanted calculations, intermediate steps, saves time and memory and
produce a sequence of transformations.
We represent each Cartesian coordinate position (x, y) with the homogeneous coordinate
triple(𝑥ℎ, 𝑦ℎ, ℎ), where, 𝑥 = 𝑥ℎ/ℎ, 𝑦 = 𝑦ℎ/ℎ. (h is 1 usually for 2D case).
Therefore, (x, y) in Cartesian system is represented as (x, y, 1) in homogeneous co-ordinate
system.

For Translation: 𝑻(𝒕𝒙, 𝒕𝒚)

𝑃′ = 𝑇. 𝑃
1 0 𝑡𝑥 𝑥
𝑥′′
Where, 𝑃′ = [𝑦 ], 𝑇 = [0 1 𝑡𝑦] & 𝑃 = [𝑦]
1 0 0 1 1
By which we can
get,
𝑥′=𝑥 + 𝑡𝑥
𝑦′=𝑦 + 𝑡𝑦


For Rotation: R(𝜽 )

𝑃′ = 𝑅. 𝑃
𝑐𝑜𝑠𝜃 −𝑠𝑖𝑛𝜃 0 𝑥
𝑥′′
Where, 𝑃′ = [𝑦 ], 𝑅 = [𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0] & 𝑃 = [𝑦]
1 0 0 1 1

Written for

Institution
Course

Document information

Uploaded on
March 23, 2024
Number of pages
39
Written in
2023/2024
Type
Class notes
Professor(s)
Jagadheeswar
Contains
All classes

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
rakeshyadav3

Get to know the seller

Seller avatar
rakeshyadav3 Jawaharlal Nehru technological University Hyderabad
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
2
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions