SlideShare a Scribd company logo
2
Most read
3
Most read
7
Most read
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

PPTX
STACKS IN DATASTRUCTURE
PPTX
2D Transformation
PPTX
2d-transformation
PDF
2D Transformations(Computer Graphics)
PPTX
Data Structures - Lecture 9 [Stack & Queue using Linked List]
PPTX
3D transformation in computer graphics
PPTX
PPT
2 d geometric transformations
STACKS IN DATASTRUCTURE
2D Transformation
2d-transformation
2D Transformations(Computer Graphics)
Data Structures - Lecture 9 [Stack & Queue using Linked List]
3D transformation in computer graphics
2 d geometric transformations

What's hot (20)

PPTX
Computer Graphic - Lines, Circles and Ellipse
PPTX
Computer Graphics
PPT
Two dimensional viewing
PPTX
Circle generation algorithm
PPT
PDF
Unit 3
PPTX
3D Transformation
PPTX
Simplex stop and_wait_protocol
PPTX
3D Transformation in Computer Graphics
PPTX
Composite transformation
PPT
COMPOSITE TRANSFORMATION COMPUTER GRAPHICDS.ppt
PPT
Strings
PPT
2D transformation (Computer Graphics)
PPTX
Longest Common Subsequence
PPT
Transformations in Computer Graphics
PPT
Composite transformations
PPTX
10.m way search tree
PPTX
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
PPTX
Dda algorithm
Computer Graphic - Lines, Circles and Ellipse
Computer Graphics
Two dimensional viewing
Circle generation algorithm
Unit 3
3D Transformation
Simplex stop and_wait_protocol
3D Transformation in Computer Graphics
Composite transformation
COMPOSITE TRANSFORMATION COMPUTER GRAPHICDS.ppt
Strings
2D transformation (Computer Graphics)
Longest Common Subsequence
Transformations in Computer Graphics
Composite transformations
10.m way search tree
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
Dda algorithm
Ad

Similar to 2D Transformation (20)

DOC
Unit 3 notes
PPTX
moule 3 ppt1 basic 2D transformations.pptx
PPT
2 d transformations by amit kumar (maimt)
PPTX
2hjsakhvchcvj hSKchvsABJChjSVCHjhvcvdxz.pptx
PPT
06.Transformation.ppt
PPT
“Transformations are the operations applied to geometrical description of an ...
PDF
Unit-3 overview of transformations
PPT
2d transformation
PPT
2D_transformatiomcomputer graphics 2d translation, rotation and scaling trans...
PPTX
seminar on 2D transformation
PDF
2-D Transformations.pdf
PPTX
Two dimensionaltransformations
PPTX
Computer Graphics Unit 2
PPT
Transforms UNIt 2
PPT
Two dimensional_Transformations Notes.ppt
PPT
2 d transformation
PPTX
Computer graphics basic transformation
PPTX
Computer Graphics - transformations in 2d
PPTX
Computer Graphic - Transformations in 2D
PDF
2D-transformation-1.pdf
Unit 3 notes
moule 3 ppt1 basic 2D transformations.pptx
2 d transformations by amit kumar (maimt)
2hjsakhvchcvj hSKchvsABJChjSVCHjhvcvdxz.pptx
06.Transformation.ppt
“Transformations are the operations applied to geometrical description of an ...
Unit-3 overview of transformations
2d transformation
2D_transformatiomcomputer graphics 2d translation, rotation and scaling trans...
seminar on 2D transformation
2-D Transformations.pdf
Two dimensionaltransformations
Computer Graphics Unit 2
Transforms UNIt 2
Two dimensional_Transformations Notes.ppt
2 d transformation
Computer graphics basic transformation
Computer Graphics - transformations in 2d
Computer Graphic - Transformations in 2D
2D-transformation-1.pdf
Ad

Recently uploaded (20)

PDF
A systematic review of self-coping strategies used by university students to ...
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
What if we spent less time fighting change, and more time building what’s rig...
PPTX
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
PDF
RMMM.pdf make it easy to upload and study
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
advance database management system book.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Digestion and Absorption of Carbohydrates, Proteina and Fats
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
Indian roads congress 037 - 2012 Flexible pavement
PPTX
Unit 4 Skeletal System.ppt.pptxopresentatiom
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
A systematic review of self-coping strategies used by university students to ...
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
What if we spent less time fighting change, and more time building what’s rig...
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
RMMM.pdf make it easy to upload and study
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
LDMMIA Reiki Yoga Finals Review Spring Summer
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Supply Chain Operations Speaking Notes -ICLT Program
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
advance database management system book.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Digestion and Absorption of Carbohydrates, Proteina and Fats
Final Presentation General Medicine 03-08-2024.pptx
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Indian roads congress 037 - 2012 Flexible pavement
Unit 4 Skeletal System.ppt.pptxopresentatiom
Weekly quiz Compilation Jan -July 25.pdf
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين

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)