SlideShare a Scribd company logo
1 of 9
Download to read offline
Assignment No.2
Submitted To:
Ma’am Aqsa Naeem
Subject:
Computer Graphics
Topics:
 Transformation
 2D transformation
 Basic Types of transformation
 Translation
 Rotation
 Scaling
 Composite Transformation
 Window to viewport Transformation
Submitted By
Name:
Asma Tehseen
Roll No
1823110013 (319)
Class
BSCS-IV
Submission Date:
18th
may, 2020
Department of Computer Science
Transformation
“In graphics, transformation means to change described
object by moving, rotating or scaling that object while following
some specific rules.”
Or
“A transformation is any operation on a point in a space (x,y)
that maps the point’s coordinates into a new set of coordinates
i. e; (x1,y1).”
Simply moves an object from one position to another following this
equation:
dyyy
dxxx
oldnew
oldnew


2D Transformation
“The transformation takes place in 2D plane to re-position
graphics, size or orientation of an object on screen is known as
2D Transformation.”
Types of Transformation:
There are several types of basic transformations:
 Translation
 Rotation
 Scale
Translation:
“A translation is applied to an object by re-positioning it along a
straight line path from one coordinate location to another.”
In 2D Translation, a point moves to a specified distance in the x or y
direction.
It is performed by adding translation distances,tx and ty to the original
coordinate position (x,y) to move the point to a new position (x’,y’)
yty
x


'
x
'
y
tx
The translation distance pair (tx, ty) is called a translation vector or
shift vector.
In translation, deformation of image does not occur as every point on the
object is translated by the same amount.
Translation equation in matrix form is represented as:







2
1
x
x
P 






2
1
'
'
'
x
x
P 






y
x
t
t
T
Row vector form:
 yxP  yx ttT
P=(x,y)
P1=(2,3) , P2=(1,1) , P3=(3,1)
While translation T=(tx,ty) is at (5,3)
For P = (2,3)
P’1= (2,3) + (5,3) = (7,6)
P’2= (1,1) + (5,3) = (6,4)
P’3= (3,1) + (5,3) = (8,4)
y
X
(0,0)
1
1
2
2
3 4 5 6 7 8 9 1
3
4
5
6P1(2,3)
P2(1,1) P3(3,1)
y
x
1
2
3
4
5
6
(6,4)
(8,4)
(7,6)
Where
P’ = P + T
Translated by (5, 3)
X’ = x + dx
y’ = y + dy
P’ = (x’ , y’)
x’ = x + tx
y’ = y + ty
Rotation:
“A two dimensional rotation is applied on an object by
re-positioning it along a circular path in the xy plane.”
It causes a point to be moved relative to a central point, without changing
the distance of r from the central point. While, Rotation angle θ and
Rotation point (xr,yr) are specified to generate rotation.
Rotation point is the point about which the object will rotate also known
as pivot point.
Positive values of rotation angle define counterclockwise rotations about
the rotation point and Negative values indicate the rotation in clockwise
direction.
For the equation of rotation, r is the constant distance of the point form
the origin, angle Φ is the original angular position and θ is the rotational
angle.
 sinsincoscos)cos(' rrrx 
 cossinsincos)sin(' rrry 
Original coordinates of the point are:
cosrx  sinry 
By equation 1


cossin'
sincos'
yxy
yxx


In column vector form rotation is defined as: P’=R.P
Where rotation matrix is:





 



cossin
sincos
R
For positive rotation it becomes: For negative rotation:





 



cossin
sincos
R 








cossin-
sincos
R
1
(x,y)
(x’,y’)
r
r
Φ
θ
Rotation is also a rigid body transformation, as image deformation doesn't
occur. Since, every point on the object is rotated through the same angle.
Scaling
“This transformation alters the size and possibly the position of object.”
Scaling operation is performed by multiplying the coordinate values (x,y)
of each vertex by scaling factors sx and sy to produce the transformed
coordinates (x’,y’).
y
x
syy
sxx
.'
.'


sx scales the object in x direction and sy scales the object in y direction
P’ = S.P
Scaling factors(sx, sy)can be assigned any +ve numeric values.
 Values less than 1deduce the size of the objects
 Values greater than 1 produce an enlargement
 1 value for both does not make any changes to the size of the object
In Matrix form:


















y
x
s
s
y
x
y
x
.
0
0
'
'
The location of a scaled object can be controlled by choosing a position,
called the fixed point, that is to remain unchanged after the scaling
transformation.while,the Coordinates for the fixed point (xf, yf) can be
chosen as one of the vertices, the object centroid, or any other position.
Object is rotated at
Rotational angle θ
from
Original angle Φ
Scale by (2, 2)
P = (x, y) P’=(x’,y’) ; S = (2,2)
P1=(2,3) P’1 =(2,3).(2,2)=(4,6)
P2=(1,1) P’2=(1,1).(2,2) =(2,2)
P3=(3,1) P’3=(3,1).(2,2)=(6,2)
Composite Transformation
Composite transformation is achieved by concatenation of two
or more transformation matrices to obtained a combined
transformation matrix.
i. e; composite Transformation matrix.matrix
Operations perform in Composite transformation:
Rotate about an arbitrary point translate,rotate,translate
Scale about an arbitrary point translate, scale,translate
Change Co-ordinate system translate, rotate, scale
y
0 1
1
2
2
3 4 5 6 7 8 9 1
3
4
5
6
(2, 3)
(1, 1) (3,1)
x’ = sx*x
y’ = sy*y
y
0 1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6
(2, 2) (6, 2)
(4,6)
Since, the composite transformations are as follows:
 Composite Translation:
The two successive translation vectors (tx1, tyl) and (tx2, ty2)
are applied to a coordinate position P, the final transformed location
P' is calculated as
P’=[T{tx2,ty2}.T{tx1,ty1}].P
In matrix form

































100
tyty10
txtx01
100
ty10
tx01
.
100
ty10
tx01
12
12
1
1
2
2
Hence, two successive translations are additive.
 Composite Rotation
Two successive rotations applied to point p product the transformed
position
P' = {R(θ2) . R(θ1) }. P
By multiplying the two rotation matrices, we can verify that two
successive rotations are additive
PRP
PRRP
)..('
).().('
12
12




so that the final rotated coordinates with the composite rotation matrix is












100
0)21cos()21sin(
0)21sin(-)21cos(


 Composite Scaling
Concatenating transformation matrices for two successive scaling
operations produces the following composite scaling matrix:































100
0Sy.Sy0
00Sx.Sx
100
0Sy0
00Sx
.
100
0Sy0
00Sx
1
1
2
2
OR
).,.().()..( 21211122 sysysxsxSsysxSsysxS 
The resulting matrix indicates that successive scaling operations are
multiplicative. To triple the size of an object twice in succession, then the
final size would be nine times of original object.
Window to Viewport Transformation
“The process of transforming a two dimensional, world
coordinate scene into device coordinates.”
In particular, object inside world or clipping window are
mapped to viewport.
Clipping window Viewport
Purpose:
The purpose of this transformation is to convert the size of clipping
window to size of viewport by using some mathematical computations.
Steps for window to viewport transformation:
1. Translate window towards origin i.e; lower left corner and upper
left corner of window become negative.
2. Resize window to viewport size applying following computation
minmax
minmax
x
XWXW
XVXV
S


 &
minmax
minmax
ywyw
yvyv
Sy



3. Translate window I.e; position of window and viewport is same.
i. if viewport is at(0,0) then don’t translate because window is
already at origin.
ii. If viewport is not at (0,0) take translation factor positive.
World port/clipping window:
The part of world
coordinate to be displayed on
screen.
Viewport:
Rectangular region
selected for displaying image
on computer screen.
YW-max
YW-min
XW-min XW-max
Viewport Coordinate
YV-max
YV-min
XV-min XV-max
Window in
world coordinate
Window translated
to Origin
Window scaled to size
of viewport
Translated by (xmin,ymin)
to final position
(Xmax,Ymax)
(Xmin,Ymin)
(Xmin,Ymin)
(Xmax.Ymax)
Mathematical Computation:













































100
y-10
x-01
.
100
0
yy
vv
0
00
x-x
u-u
.
100
v10
u01
)y-,T(-x).,
x-x
u-u
).S(v,T(u
vieporttowindowofMapping
)v,T(u
viewportofnTranslatio
),
x-x
u-u
S(
viewporttowindowofScaling
)y-,T(-x
windowofanslationrT
min
min
minmax
minmax
minmax
minmax
min
min
minmin
minmax
minmax
minmax
minmax
minmax
minmax
minmax
minmax
minmax
minmax
minmin
yy
vv
yy
vv

More Related Content

What's hot

2D Transformation
2D Transformation2D Transformation
2D TransformationShahDhruv21
 
Unit 3
Unit 3Unit 3
Unit 3ypnrao
 
Du1 complex numbers and sequences
Du1 complex numbers and sequencesDu1 complex numbers and sequences
Du1 complex numbers and sequencesjmancisidor
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingAnkit Garg
 
2d-transformation
2d-transformation2d-transformation
2d-transformationPooja Dixit
 
Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphicsShaishavShah8
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphicssabbirantor
 
Computer graphics lab report with code in cpp
Computer graphics lab report with code in cppComputer graphics lab report with code in cpp
Computer graphics lab report with code in cppAlamgir Hossain
 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithmMani Kanth
 
3 d transformation
3 d transformation3 d transformation
3 d transformationPooja Dixit
 
Cohen and Sutherland Algorithm for 7-8 marks
Cohen and Sutherland Algorithm for 7-8 marksCohen and Sutherland Algorithm for 7-8 marks
Cohen and Sutherland Algorithm for 7-8 marksRehan Khan
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clippingMani Kanth
 
Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...Mani Kanth
 
3d transformation computer graphics
3d transformation computer graphics 3d transformation computer graphics
3d transformation computer graphics University of Potsdam
 
Midpoint circle algo
Midpoint circle algoMidpoint circle algo
Midpoint circle algoMohd Arif
 
Bresenham's line algorithm
Bresenham's line algorithmBresenham's line algorithm
Bresenham's line algorithmPooja Dixit
 

What's hot (20)

2D Transformation
2D Transformation2D Transformation
2D Transformation
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
calculus Ppt
calculus Pptcalculus Ppt
calculus Ppt
 
Unit 3
Unit 3Unit 3
Unit 3
 
Du1 complex numbers and sequences
Du1 complex numbers and sequencesDu1 complex numbers and sequences
Du1 complex numbers and sequences
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
2d-transformation
2d-transformation2d-transformation
2d-transformation
 
Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphics
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphics
 
Computer graphics lab report with code in cpp
Computer graphics lab report with code in cppComputer graphics lab report with code in cpp
Computer graphics lab report with code in cpp
 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithm
 
Bezier curve computer graphics
Bezier curve computer graphics Bezier curve computer graphics
Bezier curve computer graphics
 
3 d transformation
3 d transformation3 d transformation
3 d transformation
 
Cohen and Sutherland Algorithm for 7-8 marks
Cohen and Sutherland Algorithm for 7-8 marksCohen and Sutherland Algorithm for 7-8 marks
Cohen and Sutherland Algorithm for 7-8 marks
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clipping
 
Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...
 
3d transformation computer graphics
3d transformation computer graphics 3d transformation computer graphics
3d transformation computer graphics
 
Midpoint circle algo
Midpoint circle algoMidpoint circle algo
Midpoint circle algo
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Bresenham's line algorithm
Bresenham's line algorithmBresenham's line algorithm
Bresenham's line algorithm
 

Similar to 2D Transformation

2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)Amit Kapoor
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformationsMohd Arif
 
Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2aravindangc
 
Unit-3 overview of transformations
Unit-3 overview of transformationsUnit-3 overview of transformations
Unit-3 overview of transformationsAmol Gaikwad
 
Two dimentional transform
Two dimentional transformTwo dimentional transform
Two dimentional transformPatel Punit
 
2 d translation
2 d translation2 d translation
2 d translationMani Kanth
 
Lecture 6-1543909797
Lecture 6-1543909797Lecture 6-1543909797
Lecture 6-1543909797Canh Le
 
Two dimensionaltransformations
Two dimensionaltransformationsTwo dimensionaltransformations
Two dimensionaltransformationsNareek
 
Bla b__________________la -2&3d -DD .ppt
Bla b__________________la -2&3d -DD .pptBla b__________________la -2&3d -DD .ppt
Bla b__________________la -2&3d -DD .pptkdemersal
 
Three dimensional geometric transformations
Three dimensional geometric transformationsThree dimensional geometric transformations
Three dimensional geometric transformationsshanthishyam
 
2 d transformation
2 d transformation2 d transformation
2 d transformationAnkit Garg
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphicsSHIVANI SONI
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversionMohd Arif
 
2Dand3D transformationppt.pptx
2Dand3D transformationppt.pptx2Dand3D transformationppt.pptx
2Dand3D transformationppt.pptxRAMESHCHANDRANE
 
seminar on 2D transformation
seminar on 2D transformationseminar on 2D transformation
seminar on 2D transformation9784
 

Similar to 2D Transformation (20)

06.Transformation.ppt
06.Transformation.ppt06.Transformation.ppt
06.Transformation.ppt
 
2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformations
 
Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2
 
Unit 3 notes
Unit 3 notesUnit 3 notes
Unit 3 notes
 
Unit-3 overview of transformations
Unit-3 overview of transformationsUnit-3 overview of transformations
Unit-3 overview of transformations
 
Two dimentional transform
Two dimentional transformTwo dimentional transform
Two dimentional transform
 
Computer graphics presentation
Computer graphics presentationComputer graphics presentation
Computer graphics presentation
 
2 d translation
2 d translation2 d translation
2 d translation
 
Lecture 6-1543909797
Lecture 6-1543909797Lecture 6-1543909797
Lecture 6-1543909797
 
transformation IT.ppt
transformation IT.ppttransformation IT.ppt
transformation IT.ppt
 
Two dimensionaltransformations
Two dimensionaltransformationsTwo dimensionaltransformations
Two dimensionaltransformations
 
Bla b__________________la -2&3d -DD .ppt
Bla b__________________la -2&3d -DD .pptBla b__________________la -2&3d -DD .ppt
Bla b__________________la -2&3d -DD .ppt
 
2d transformation
2d transformation2d transformation
2d transformation
 
Three dimensional geometric transformations
Three dimensional geometric transformationsThree dimensional geometric transformations
Three dimensional geometric transformations
 
2 d transformation
2 d transformation2 d transformation
2 d transformation
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphics
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversion
 
2Dand3D transformationppt.pptx
2Dand3D transformationppt.pptx2Dand3D transformationppt.pptx
2Dand3D transformationppt.pptx
 
seminar on 2D transformation
seminar on 2D transformationseminar on 2D transformation
seminar on 2D transformation
 

Recently uploaded

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 

Recently uploaded (20)

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 

2D Transformation

  • 1. Assignment No.2 Submitted To: Ma’am Aqsa Naeem Subject: Computer Graphics Topics:  Transformation  2D transformation  Basic Types of transformation  Translation  Rotation  Scaling  Composite Transformation  Window to viewport Transformation Submitted By Name: Asma Tehseen Roll No 1823110013 (319) Class BSCS-IV Submission Date: 18th may, 2020 Department of Computer Science
  • 2. Transformation “In graphics, transformation means to change described object by moving, rotating or scaling that object while following some specific rules.” Or “A transformation is any operation on a point in a space (x,y) that maps the point’s coordinates into a new set of coordinates i. e; (x1,y1).” Simply moves an object from one position to another following this equation: dyyy dxxx oldnew oldnew   2D Transformation “The transformation takes place in 2D plane to re-position graphics, size or orientation of an object on screen is known as 2D Transformation.” Types of Transformation: There are several types of basic transformations:  Translation  Rotation  Scale Translation: “A translation is applied to an object by re-positioning it along a straight line path from one coordinate location to another.” In 2D Translation, a point moves to a specified distance in the x or y direction. It is performed by adding translation distances,tx and ty to the original coordinate position (x,y) to move the point to a new position (x’,y’)
  • 3. yty x   ' x ' y tx The translation distance pair (tx, ty) is called a translation vector or shift vector. In translation, deformation of image does not occur as every point on the object is translated by the same amount. Translation equation in matrix form is represented as:        2 1 x x P        2 1 ' ' ' x x P        y x t t T Row vector form:  yxP  yx ttT P=(x,y) P1=(2,3) , P2=(1,1) , P3=(3,1) While translation T=(tx,ty) is at (5,3) For P = (2,3) P’1= (2,3) + (5,3) = (7,6) P’2= (1,1) + (5,3) = (6,4) P’3= (3,1) + (5,3) = (8,4) y X (0,0) 1 1 2 2 3 4 5 6 7 8 9 1 3 4 5 6P1(2,3) P2(1,1) P3(3,1) y x 1 2 3 4 5 6 (6,4) (8,4) (7,6) Where P’ = P + T Translated by (5, 3) X’ = x + dx y’ = y + dy P’ = (x’ , y’) x’ = x + tx y’ = y + ty
  • 4. Rotation: “A two dimensional rotation is applied on an object by re-positioning it along a circular path in the xy plane.” It causes a point to be moved relative to a central point, without changing the distance of r from the central point. While, Rotation angle θ and Rotation point (xr,yr) are specified to generate rotation. Rotation point is the point about which the object will rotate also known as pivot point. Positive values of rotation angle define counterclockwise rotations about the rotation point and Negative values indicate the rotation in clockwise direction. For the equation of rotation, r is the constant distance of the point form the origin, angle Φ is the original angular position and θ is the rotational angle.  sinsincoscos)cos(' rrrx   cossinsincos)sin(' rrry  Original coordinates of the point are: cosrx  sinry  By equation 1   cossin' sincos' yxy yxx   In column vector form rotation is defined as: P’=R.P Where rotation matrix is:           cossin sincos R For positive rotation it becomes: For negative rotation:           cossin sincos R          cossin- sincos R 1
  • 5. (x,y) (x’,y’) r r Φ θ Rotation is also a rigid body transformation, as image deformation doesn't occur. Since, every point on the object is rotated through the same angle. Scaling “This transformation alters the size and possibly the position of object.” Scaling operation is performed by multiplying the coordinate values (x,y) of each vertex by scaling factors sx and sy to produce the transformed coordinates (x’,y’). y x syy sxx .' .'   sx scales the object in x direction and sy scales the object in y direction P’ = S.P Scaling factors(sx, sy)can be assigned any +ve numeric values.  Values less than 1deduce the size of the objects  Values greater than 1 produce an enlargement  1 value for both does not make any changes to the size of the object In Matrix form:                   y x s s y x y x . 0 0 ' ' The location of a scaled object can be controlled by choosing a position, called the fixed point, that is to remain unchanged after the scaling transformation.while,the Coordinates for the fixed point (xf, yf) can be chosen as one of the vertices, the object centroid, or any other position. Object is rotated at Rotational angle θ from Original angle Φ
  • 6. Scale by (2, 2) P = (x, y) P’=(x’,y’) ; S = (2,2) P1=(2,3) P’1 =(2,3).(2,2)=(4,6) P2=(1,1) P’2=(1,1).(2,2) =(2,2) P3=(3,1) P’3=(3,1).(2,2)=(6,2) Composite Transformation Composite transformation is achieved by concatenation of two or more transformation matrices to obtained a combined transformation matrix. i. e; composite Transformation matrix.matrix Operations perform in Composite transformation: Rotate about an arbitrary point translate,rotate,translate Scale about an arbitrary point translate, scale,translate Change Co-ordinate system translate, rotate, scale y 0 1 1 2 2 3 4 5 6 7 8 9 1 3 4 5 6 (2, 3) (1, 1) (3,1) x’ = sx*x y’ = sy*y y 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6 (2, 2) (6, 2) (4,6)
  • 7. Since, the composite transformations are as follows:  Composite Translation: The two successive translation vectors (tx1, tyl) and (tx2, ty2) are applied to a coordinate position P, the final transformed location P' is calculated as P’=[T{tx2,ty2}.T{tx1,ty1}].P In matrix form                                  100 tyty10 txtx01 100 ty10 tx01 . 100 ty10 tx01 12 12 1 1 2 2 Hence, two successive translations are additive.  Composite Rotation Two successive rotations applied to point p product the transformed position P' = {R(θ2) . R(θ1) }. P By multiplying the two rotation matrices, we can verify that two successive rotations are additive PRP PRRP )..(' ).().(' 12 12     so that the final rotated coordinates with the composite rotation matrix is             100 0)21cos()21sin( 0)21sin(-)21cos(    Composite Scaling Concatenating transformation matrices for two successive scaling operations produces the following composite scaling matrix:                                100 0Sy.Sy0 00Sx.Sx 100 0Sy0 00Sx . 100 0Sy0 00Sx 1 1 2 2 OR ).,.().()..( 21211122 sysysxsxSsysxSsysxS  The resulting matrix indicates that successive scaling operations are multiplicative. To triple the size of an object twice in succession, then the final size would be nine times of original object.
  • 8. Window to Viewport Transformation “The process of transforming a two dimensional, world coordinate scene into device coordinates.” In particular, object inside world or clipping window are mapped to viewport. Clipping window Viewport Purpose: The purpose of this transformation is to convert the size of clipping window to size of viewport by using some mathematical computations. Steps for window to viewport transformation: 1. Translate window towards origin i.e; lower left corner and upper left corner of window become negative. 2. Resize window to viewport size applying following computation minmax minmax x XWXW XVXV S    & minmax minmax ywyw yvyv Sy    3. Translate window I.e; position of window and viewport is same. i. if viewport is at(0,0) then don’t translate because window is already at origin. ii. If viewport is not at (0,0) take translation factor positive. World port/clipping window: The part of world coordinate to be displayed on screen. Viewport: Rectangular region selected for displaying image on computer screen. YW-max YW-min XW-min XW-max Viewport Coordinate YV-max YV-min XV-min XV-max Window in world coordinate Window translated to Origin Window scaled to size of viewport Translated by (xmin,ymin) to final position (Xmax,Ymax) (Xmin,Ymin) (Xmin,Ymin) (Xmax.Ymax)