SlideShare a Scribd company logo
1 of 51
UNIT -2
Two-Dimensional Transformations
2D Transformations
 What is transformations?
 Changes in orientation , size , and shape are accomplished
with geometrical transformations that alters the coordinate
description of object.
 Why the transformations is needed?
 To manipulate the initially created object and to display the
modified object without having to redraw it.
 2 ways
 Object Transformation
• Alter the coordinates descriptions an object
• Translation, rotation, scaling etc.
• Coordinate system unchanged
 Coordinate transformation
• Produce a different coordinate system
2D Transformations
4
Transformations and Matrices
 Transformations are functions
 Matrices are functions representations
 Matrices represent linear transformation
 {2x2 Matrices}  {2D Linear Transformation}
 What are they?
 changing something to something else via rules
 mathematics: mapping between values in a range set and
domain set (function/relation)
 geometric: translate, rotate, scale, shear,…
 Why are they important to graphics?
 moving objects on screen / in space
 mapping from model space to screen space
 specifying parent/child relationships
Basic Transformations : Translation (1/2)
 Translation
 Definition : repositioning objects along a straight line path
from one position to another
 Let : original position, : new position
 We need translation distance (translation vector)
for x direction
for y direction
 Then,






y
x
=P 








y
x
=P
T =
t
t
x
y






x' x t
y' y t
x
y
 
 
Translation (2/2)
 In matrix form
 Translation is rigid-body Transformation that moves
objects without deformation
• every point on the object is translated by the same amount
 For straight line
• applying translation distance to each line end points
 For polygon, curves
P' P T
x
y
t
t
x
y
  





 






Basic Transformation : Rotation
Basic Transformations : scaling (1/2)
 Scaling
 Definition : alters the size of an objects
 we need scaling factors
: for x value
: for y value
 In matrix form
 Then
 if : Uniform scaling
: differential scaling
S
S 0
0 S
X
y







x x sx'  y y sy' 













y
x
s0
0s
PSP
y
x
s s
s s
x y
x y


scaling (2/2)
 if : uniform compression
• move objects to the coordinate origin
 if : uniform Enlargement
• move objects farther from the origin
 Fixed point scaling : scaling based on a fixed point
• An object is scaled relative to the fixed point by scaling distance
from each vertex to fixed point
• when
0 s s 1x y  
1 s sx y 
( ),x yf f
x' x (x x )s x s x (1 s )
y' y (y y )s y s y (1 s )
f f x x f x
f f y y f y
      
      
(x ,y) (0,0)f f 
18
Inverse 2D - Transformations
y
-
y
x
-
x
),(
-
(sx,sy)
(-θ
-
(θ
(-dx,-dy)
-
(dx,dy)
MM
MM
SS
RR
TT
sysx





1
1
1
)
1
)
1
:RefMirror
:Sclaing
:Rotation
:nTranslaito
11
19
Homogeneous Co-ordinates (1/3)
 Translation, scaling and rotation are expressed
(non-homogeneously) as:
translation: P = P + T
Scale: P = S · P
Rotate: P = R · P
 Composition is difficult to express, since translation
not expressed as a matrix multiplication
 Homogeneous coordinates allow all three to be expr
essed homogeneously, using multiplication by 3 ´ 3
matrices
 W is 1 for affine transformations in graphics
20
Homogeneous Co-ordinates (2/3)
 P2d is a projection of Ph onto the w = 1
plane
 So an infinite number of points correspon
d to : they constitute the whole line
(tx, ty, tw)
x
y
w Ph(x,y,w)
P2d(x,y,1)
w=1
Homogeneous Coordinates (3/3)
 For Translation, Rotation, Scaling


































1
y
x
100
t10
t01
s
y
x
y
x


























1
y
x
100
0cossin
0sin-cos
s
y
x




































1
y
x
100
0s0
00s
s
y
x
y
x
Translation:
Scaling:
Rotation:
22
Classification of Transformations
1. Rigid-body Transformation
 Preserves parallelism of lines
 Preserves angle and length
 e.g. any sequence of R() and T(dx,dy)
2. Affine Transformation
 Preserves parallelism of lines
 Doesn’t preserve angle and length
 e.g. any sequence of R(), S(sx,sy) and T(dx,dy)
unit cube 45 deg rotaton Scale in X not in Y
23
Properties of rigid-body transformation










100
2221
1211
y
x
trr
trr
The following Matrix is Orthogonal if the upper left 2X2 matrix has the
following properties
1.A) Each row are unit vector.
sqrt(r11* r11 + r12* r12) = 1
B) Each column are unit vector.
sqrt(c11* c11 + c12* c12) = 1
2.A) Rows will be perpendicular to each other
(r11 , r12 ) . ( r21 , r22) = 0
B) Columns will be perpendicular to each other
(c11 , c12 ) . (c21 ,c22) = 0
e.g. Rotation matrix is orthogonal









 
100
0cossin
0sincos


• Orthogonal Transformation  Rigid-Body Transformation
• For any orthogonal matrix B  B-1 = BT
Concatenation properties.
 Matrix multiplication : associative
• ex) For three matrices A, B and C
• Translation or Rotation : additive property commutative
• scaling : multiplicative property commutative
 However, Translation and Rotation : non commutative
• order of transformation matrix multiplication is important
A B C (A B) C A (B C)       
ABBA 
26
Commutative of Transformation Matrices
• In general matrix multiplication is not commutative
• For the following special cases commutativity holds i.e. M1.M2 = M2.M1
M1 M2
Translate Translate
Scale Scale
Rotate Rotate
Uniform Scale Rotate
• Some non-commutative
Compositions:
 Non-uniform scale, Rotate
 Translate, Scale
 Rotate, Translate
Original
Transitional
Final
Composite Transformation (1/2)
 Translation
 If two successive translation factor (tx1, ty1) and (tx2, ty2) are
applied to a coordinate point P
• then
• ex)
i.e,
 Two successive Translation are additive
1 0 t
0 1 t
0 0 1
1 0 t
0 1 t
0 0 1
1 0 t t
0 1 t t
0 0 1
x2
y2
x1
y1
x1 x2
y1 y2


































P' T (t ,t ) {T (t ,t ) P} {T (t ,t ) T (t ,t )} P2 X2 y2 1 x1 y1 2 X2 y2 1 x1 y1     
T(t ,t ) T(t ,t ) T(t t ,t t )x2 y2 x1 y1 x1 x2 y1 y2   
Composite Transformation (2/2)
 Rotation
 two successive rotation
 two successive rotations are also additive
 Scaling
 successive scalings are multiplicative
P)}R(){R(P}){R()R(P 1212  
)R()R()R( 2121  
P' R( ) P1 2   
  ,

































100
0ss0
00ss
100
0s0
00s
100
0s0
00s
y2y1
x2x1
y1
x1
y2
x2
S(S ,S ) S(S ,S ) S(S S ,S S )X2 Y2 X1 Y1 X1 X2 Y1 Y2   
General pivot-point Rotation (1/2)
 Rotation about arbitrary point p (xr, yr)
 step1) Translate P to origin
 step2) Rotation about origin
 step3) Retranslation to position P.
General pivot-point Rotation (2/2)
 Composite transformation matrix
 
 
  


  
 
 
  


  
x
y
x
y
x y
y x
r
r
r
r
r r
r r

































  
 










cos sin
sin cos
cos sin ( cos ) sin
sin cos ( cos ) sin
 
 
   
   
),y,R(x),-yT(-x)R()y,T(x rrrrrr  
General Fixed Point Scaling
General Fixed-Point Scaling
 Scaling about arbitrary point p(xr, yr)
 step 1) translate p to origin
 step 2) scaling about origin
 step 3) Retranslate to position P
 
 
  
 
 
  
 
 
  
 
 
  
x
y
s
s
x
y
s x s
s y s
r
r
x
y
r
r
x r x
y r y













































( )
( ) )ss,y,S(x),-yT(-x)sS(s)y,T(x yxffffyxff ,, 
Other Transformations : Reflection (1/3)
 Reflection : produce a mirror images of an object
 We need axis of reflection
 rotating the objects 180°about reflection axis
 Reflection about the x axis: Just flip the y coordinate
 Reflection about the y axis: Just flip the x coordinate
 Reflection about the origin, flip both coordinates
1
32
1
32
1
32
1’
3’2’
1’
2’3’
1’
2’3’
Reflection about x axis Reflection about y axis Reflection about origin
Reflection (2/3)
R
1 0 0
0 1 0
0 0 1
y 










R
1 0 0
0 1 0
0 0 1
X  









 












100
010
001
R0
Reflection (3/3)
 Reflection through arbitrary point P (xr, yr)
• translate point p to origin : Tr
• perform reflection about origin : Ro
• retranslate to original position : Tr
 Reflection through y=x line


































100
y10
x01
100
010
001
100
y10
x01
r
r
r
r
0 1 0
1 0 0
0 0 1










Reflection through an arbitrary line y=Lx+b
Shear Transformation
 Shear : distorts the shape of an object
 Shear transformation that distorts the shape of an object such that the
transformed shape appears as if the object were composed of internal
layers that had been caused to slide over each other.
 Shearing (slide over) can be in either x or y direction
 In X Shear, x-values changes along x-direction by shearing factor of shx
• point is shifted by horizontally by an amount proportional to its
distance from x-axis
• y values are unchanged
 In Y Shear, y-values changes along y-direction by shearing factor of shy
• point is shifted by vertically by an amount proportional to its distance
from y-axis
• x values are unchanged
X - Shear
Transformation matrix of X- Shear
• So,
• Transformed positions
T
1 sh 0
0 1 0
0 0 1
shx
x











x' x sh yx   ,
y' y
X –Shear relative to y- reference line
Transformation matrix of X- Shear with y- reference line
 X-direction shearing relative to liney yref
1 sh sh y
0 1 0
0 0 1
x x ref









yy'
)y(yshxx' refx


Y - Shear
y-direction










100
01sh
001
y
(x)shyy'
xx'
y

The transformation matrix for y-shear and its equation
Y – Shear relative to x reference line
 y-direction shearing relative to linex xref
1 0 0
sh 1 sh x
0 0 1
y y ref










x' x
y' y sh (x x )y ref

  
 The area of the parallelogram can be calculated as,
 Area of the trapezium =(sum of two parallel side)*h / 2
 Parea = (a+c) (b+d) – (ab) – (cd) – (b+b+d) – (c+a+c)
= ad – bc
= det
 Thus, area of any parallelogram is formed by transforming
a square which is a function of the transformation matrix
determinant and is related to the area of the initial square
Parea = Sarea (ad-bc) = Sarea det [T]
 Area of any transformed figure Tarea is related to the ar
ea of the initial figure Iarea by,
Tarea = Iarea (ad-bc)
2
1
2
1
2
c
2
b






dc
ba
WINDOW TO VIEW PORT TRANSFORMATION
ASSIGNMENT -2 TWO –D TRANSFORMATION
Assigned Date : 26-02-13
Submission Date : 05-03-13
 Fo r a l l t h e b e l o w g i v e n pr o b l e m Or i g i n a l a n d
Fi n a l po s i t i o n d i a g r a m i s n e c e s s a r y
1. Scale a square at [(2, 2), (6, 6)] along one of its diagonal and find the
new vertices.
2. Perform a clockwise 30 degree rotation of a triangle A (2, 3), B (5, 5),
C(4,3) about the point (1,1)
3. Find a transformation of triangle A (1, 0), B (0, 1), C (1, 1) by
a) Rotating 30 degree about the origin and then translating one
unit in x and y direction.
b) Translating one unit in x and y direction and then rotating 30
degree about the origin.
4. Represent a triangle at [(3, 3), (5, 6) , (7,3) ] in a new coordinate
system with origin at (3,3) and its x-axis making an angle +45 degree
with the x-direction of the base coordinate system.
5. Find out the co-ordinate of a figure bounded by (0,0) , (1,5) , (6,3) (-
3,-4) when reflected along the line whose equation is y=1 (x+5) and
sheared by 2 units in
x –direction and 2 units in y-direction.
[HINT: Ref -Page No. 3-46 in Godse Book]
6. Compute the new reflected coordinates of a point (-4,-4), when
reflected with respect to a line that passes through (-4, 0) and (0,-4)
[HINT: Ref -Page No. 3-62 in Godse Book]
7. For a point (2, 4) in a window at [(1, 1), (5, 5)], find the equivalent
point in the View Port at [(1, 1), (5, 10)].

More Related Content

What's hot

Viewing transformation
Viewing transformationViewing transformation
Viewing transformation
Udayan Gupta
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
Mohd Arif
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformation
Ankit Garg
 

What's hot (20)

Matrix representation- CG.pptx
Matrix representation- CG.pptxMatrix representation- CG.pptx
Matrix representation- CG.pptx
 
3D Transformation
3D Transformation3D Transformation
3D Transformation
 
3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
 
Curves and surfaces
Curves and surfacesCurves and surfaces
Curves and surfaces
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphics
 
Viewing transformation
Viewing transformationViewing transformation
Viewing transformation
 
3D Transformation
3D Transformation 3D Transformation
3D Transformation
 
Lecture Summary : Camera Projection
Lecture Summary : Camera Projection Lecture Summary : Camera Projection
Lecture Summary : Camera Projection
 
3D Geometric Transformations
3D Geometric Transformations3D Geometric Transformations
3D Geometric Transformations
 
Two dimensional geometric transformation
Two dimensional geometric transformationTwo dimensional geometric transformation
Two dimensional geometric transformation
 
Chapter 4 Image Processing: Image Transformation
Chapter 4 Image Processing: Image TransformationChapter 4 Image Processing: Image Transformation
Chapter 4 Image Processing: Image Transformation
 
Geometric transformation
Geometric transformationGeometric transformation
Geometric transformation
 
Bezier curve & B spline curve
Bezier curve  & B spline curveBezier curve  & B spline curve
Bezier curve & B spline curve
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfaces
 
Bresenham algorithm
Bresenham algorithmBresenham algorithm
Bresenham algorithm
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformation
 
Frame buffer
Frame bufferFrame buffer
Frame buffer
 
Overview of 2D and 3D Transformation
Overview of 2D and 3D TransformationOverview of 2D and 3D Transformation
Overview of 2D and 3D Transformation
 

Viewers also liked

Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformations
Mohammad Sadiq
 
Enlargements - Strand 2
Enlargements - Strand 2Enlargements - Strand 2
Enlargements - Strand 2
mscartersmaths
 
Transformations in geometry
Transformations in geometryTransformations in geometry
Transformations in geometry
Michael_Mika
 
Hidden surfaces
Hidden surfacesHidden surfaces
Hidden surfaces
Mohd Arif
 
Lecture 2d point,curve,text,line clipping
Lecture   2d point,curve,text,line clippingLecture   2d point,curve,text,line clipping
Lecture 2d point,curve,text,line clipping
avelraj
 

Viewers also liked (20)

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)
 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformations
 
Notes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphicsNotes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphics
 
Enlargements - Strand 2
Enlargements - Strand 2Enlargements - Strand 2
Enlargements - Strand 2
 
Surface representation
Surface representationSurface representation
Surface representation
 
Eg 2
Eg 2Eg 2
Eg 2
 
Hidden Surfaces
Hidden SurfacesHidden Surfaces
Hidden Surfaces
 
Hidden lines & surfaces
Hidden lines & surfacesHidden lines & surfaces
Hidden lines & surfaces
 
projections - engineering drawing
projections - engineering drawing projections - engineering drawing
projections - engineering drawing
 
Two dimentional transform
Two dimentional transformTwo dimentional transform
Two dimentional transform
 
Three dimensional transformations
Three dimensional transformationsThree dimensional transformations
Three dimensional transformations
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
 
Transformations in geometry
Transformations in geometryTransformations in geometry
Transformations in geometry
 
Transformations Vocabulary 2009
Transformations Vocabulary 2009Transformations Vocabulary 2009
Transformations Vocabulary 2009
 
Computer Graphics HAND BOOK 2013
Computer Graphics HAND BOOK 2013Computer Graphics HAND BOOK 2013
Computer Graphics HAND BOOK 2013
 
Hidden surfaces
Hidden surfacesHidden surfaces
Hidden surfaces
 
Windowing and clipping final1
Windowing and clipping final1Windowing and clipping final1
Windowing and clipping final1
 
2d/3D transformations in computer graphics(Computer graphics Tutorials)
2d/3D transformations in computer graphics(Computer graphics Tutorials)2d/3D transformations in computer graphics(Computer graphics Tutorials)
2d/3D transformations in computer graphics(Computer graphics Tutorials)
 
Lecture 2d point,curve,text,line clipping
Lecture   2d point,curve,text,line clippingLecture   2d point,curve,text,line clipping
Lecture 2d point,curve,text,line clipping
 
Geometric transformation 2d chapter 5
Geometric transformation 2d   chapter 5Geometric transformation 2d   chapter 5
Geometric transformation 2d chapter 5
 

Similar to Two dimensionaltransformations

GeometricTransformations.ppt
GeometricTransformations.pptGeometricTransformations.ppt
GeometricTransformations.ppt
Debjit Doira
 
2 d transformation
2 d transformation2 d transformation
2 d transformation
Ankit Garg
 
04transformation2d
04transformation2d04transformation2d
04transformation2d
Ketan Jani
 
Part 3- Manipulation and Representation of Curves.pptx
Part 3- Manipulation and Representation of Curves.pptxPart 3- Manipulation and Representation of Curves.pptx
Part 3- Manipulation and Representation of Curves.pptx
Khalil Alhatab
 
Part 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptxPart 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptx
Khalil Alhatab
 

Similar to Two dimensionaltransformations (20)

06.Transformation.ppt
06.Transformation.ppt06.Transformation.ppt
06.Transformation.ppt
 
2d transformation
2d transformation2d transformation
2d transformation
 
Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2
 
Unit-3 overview of transformations
Unit-3 overview of transformationsUnit-3 overview of transformations
Unit-3 overview of transformations
 
Unit 3 notes
Unit 3 notesUnit 3 notes
Unit 3 notes
 
Computer graphics presentation
Computer graphics presentationComputer graphics presentation
Computer graphics presentation
 
Transforms UNIt 2
Transforms UNIt 2 Transforms UNIt 2
Transforms UNIt 2
 
GeometricTransformations.ppt
GeometricTransformations.pptGeometricTransformations.ppt
GeometricTransformations.ppt
 
seminar on 2D transformation
seminar on 2D transformationseminar on 2D transformation
seminar on 2D transformation
 
2 d transformation
2 d transformation2 d transformation
2 d transformation
 
transformation IT.ppt
transformation IT.ppttransformation IT.ppt
transformation IT.ppt
 
Computer Graphics - transformations in 2d
Computer Graphics - transformations in 2dComputer Graphics - transformations in 2d
Computer Graphics - transformations in 2d
 
Computer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2DComputer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2D
 
2d transformations
2d transformations2d transformations
2d transformations
 
04transformation2d
04transformation2d04transformation2d
04transformation2d
 
Part 3- Manipulation and Representation of Curves.pptx
Part 3- Manipulation and Representation of Curves.pptxPart 3- Manipulation and Representation of Curves.pptx
Part 3- Manipulation and Representation of Curves.pptx
 
Cs8092 computer graphics and multimedia unit 2
Cs8092 computer graphics and multimedia unit 2Cs8092 computer graphics and multimedia unit 2
Cs8092 computer graphics and multimedia unit 2
 
Part 2- Transformation.pptx
Part 2- Transformation.pptxPart 2- Transformation.pptx
Part 2- Transformation.pptx
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Part 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptxPart 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptx
 

Recently uploaded

scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 

Two dimensionaltransformations

  • 2. 2D Transformations  What is transformations?  Changes in orientation , size , and shape are accomplished with geometrical transformations that alters the coordinate description of object.  Why the transformations is needed?  To manipulate the initially created object and to display the modified object without having to redraw it.
  • 3.  2 ways  Object Transformation • Alter the coordinates descriptions an object • Translation, rotation, scaling etc. • Coordinate system unchanged  Coordinate transformation • Produce a different coordinate system 2D Transformations
  • 4. 4 Transformations and Matrices  Transformations are functions  Matrices are functions representations  Matrices represent linear transformation  {2x2 Matrices}  {2D Linear Transformation}  What are they?  changing something to something else via rules  mathematics: mapping between values in a range set and domain set (function/relation)  geometric: translate, rotate, scale, shear,…  Why are they important to graphics?  moving objects on screen / in space  mapping from model space to screen space  specifying parent/child relationships
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. Basic Transformations : Translation (1/2)  Translation  Definition : repositioning objects along a straight line path from one position to another  Let : original position, : new position  We need translation distance (translation vector) for x direction for y direction  Then,       y x =P          y x =P T = t t x y       x' x t y' y t x y    
  • 12. Translation (2/2)  In matrix form  Translation is rigid-body Transformation that moves objects without deformation • every point on the object is translated by the same amount  For straight line • applying translation distance to each line end points  For polygon, curves P' P T x y t t x y                
  • 14.
  • 15.
  • 16. Basic Transformations : scaling (1/2)  Scaling  Definition : alters the size of an objects  we need scaling factors : for x value : for y value  In matrix form  Then  if : Uniform scaling : differential scaling S S 0 0 S X y        x x sx'  y y sy'               y x s0 0s PSP y x s s s s x y x y  
  • 17. scaling (2/2)  if : uniform compression • move objects to the coordinate origin  if : uniform Enlargement • move objects farther from the origin  Fixed point scaling : scaling based on a fixed point • An object is scaled relative to the fixed point by scaling distance from each vertex to fixed point • when 0 s s 1x y   1 s sx y  ( ),x yf f x' x (x x )s x s x (1 s ) y' y (y y )s y s y (1 s ) f f x x f x f f y y f y               (x ,y) (0,0)f f 
  • 18. 18 Inverse 2D - Transformations y - y x - x ),( - (sx,sy) (-θ - (θ (-dx,-dy) - (dx,dy) MM MM SS RR TT sysx      1 1 1 ) 1 ) 1 :RefMirror :Sclaing :Rotation :nTranslaito 11
  • 19. 19 Homogeneous Co-ordinates (1/3)  Translation, scaling and rotation are expressed (non-homogeneously) as: translation: P = P + T Scale: P = S · P Rotate: P = R · P  Composition is difficult to express, since translation not expressed as a matrix multiplication  Homogeneous coordinates allow all three to be expr essed homogeneously, using multiplication by 3 ´ 3 matrices  W is 1 for affine transformations in graphics
  • 20. 20 Homogeneous Co-ordinates (2/3)  P2d is a projection of Ph onto the w = 1 plane  So an infinite number of points correspon d to : they constitute the whole line (tx, ty, tw) x y w Ph(x,y,w) P2d(x,y,1) w=1
  • 21. Homogeneous Coordinates (3/3)  For Translation, Rotation, Scaling                                   1 y x 100 t10 t01 s y x y x                           1 y x 100 0cossin 0sin-cos s y x                                     1 y x 100 0s0 00s s y x y x Translation: Scaling: Rotation:
  • 22. 22 Classification of Transformations 1. Rigid-body Transformation  Preserves parallelism of lines  Preserves angle and length  e.g. any sequence of R() and T(dx,dy) 2. Affine Transformation  Preserves parallelism of lines  Doesn’t preserve angle and length  e.g. any sequence of R(), S(sx,sy) and T(dx,dy) unit cube 45 deg rotaton Scale in X not in Y
  • 23. 23 Properties of rigid-body transformation           100 2221 1211 y x trr trr The following Matrix is Orthogonal if the upper left 2X2 matrix has the following properties 1.A) Each row are unit vector. sqrt(r11* r11 + r12* r12) = 1 B) Each column are unit vector. sqrt(c11* c11 + c12* c12) = 1 2.A) Rows will be perpendicular to each other (r11 , r12 ) . ( r21 , r22) = 0 B) Columns will be perpendicular to each other (c11 , c12 ) . (c21 ,c22) = 0 e.g. Rotation matrix is orthogonal            100 0cossin 0sincos   • Orthogonal Transformation  Rigid-Body Transformation • For any orthogonal matrix B  B-1 = BT
  • 24. Concatenation properties.  Matrix multiplication : associative • ex) For three matrices A, B and C • Translation or Rotation : additive property commutative • scaling : multiplicative property commutative  However, Translation and Rotation : non commutative • order of transformation matrix multiplication is important A B C (A B) C A (B C)        ABBA 
  • 25.
  • 26. 26 Commutative of Transformation Matrices • In general matrix multiplication is not commutative • For the following special cases commutativity holds i.e. M1.M2 = M2.M1 M1 M2 Translate Translate Scale Scale Rotate Rotate Uniform Scale Rotate • Some non-commutative Compositions:  Non-uniform scale, Rotate  Translate, Scale  Rotate, Translate Original Transitional Final
  • 27. Composite Transformation (1/2)  Translation  If two successive translation factor (tx1, ty1) and (tx2, ty2) are applied to a coordinate point P • then • ex) i.e,  Two successive Translation are additive 1 0 t 0 1 t 0 0 1 1 0 t 0 1 t 0 0 1 1 0 t t 0 1 t t 0 0 1 x2 y2 x1 y1 x1 x2 y1 y2                                   P' T (t ,t ) {T (t ,t ) P} {T (t ,t ) T (t ,t )} P2 X2 y2 1 x1 y1 2 X2 y2 1 x1 y1      T(t ,t ) T(t ,t ) T(t t ,t t )x2 y2 x1 y1 x1 x2 y1 y2   
  • 28. Composite Transformation (2/2)  Rotation  two successive rotation  two successive rotations are also additive  Scaling  successive scalings are multiplicative P)}R(){R(P}){R()R(P 1212   )R()R()R( 2121   P' R( ) P1 2      ,                                  100 0ss0 00ss 100 0s0 00s 100 0s0 00s y2y1 x2x1 y1 x1 y2 x2 S(S ,S ) S(S ,S ) S(S S ,S S )X2 Y2 X1 Y1 X1 X2 Y1 Y2   
  • 29. General pivot-point Rotation (1/2)  Rotation about arbitrary point p (xr, yr)  step1) Translate P to origin  step2) Rotation about origin  step3) Retranslation to position P.
  • 30. General pivot-point Rotation (2/2)  Composite transformation matrix                         x y x y x y y x r r r r r r r r                                                 cos sin sin cos cos sin ( cos ) sin sin cos ( cos ) sin             ),y,R(x),-yT(-x)R()y,T(x rrrrrr  
  • 32. General Fixed-Point Scaling  Scaling about arbitrary point p(xr, yr)  step 1) translate p to origin  step 2) scaling about origin  step 3) Retranslate to position P                             x y s s x y s x s s y s r r x y r r x r x y r y                                              ( ) ( ) )ss,y,S(x),-yT(-x)sS(s)y,T(x yxffffyxff ,, 
  • 33. Other Transformations : Reflection (1/3)  Reflection : produce a mirror images of an object  We need axis of reflection  rotating the objects 180°about reflection axis
  • 34.  Reflection about the x axis: Just flip the y coordinate  Reflection about the y axis: Just flip the x coordinate  Reflection about the origin, flip both coordinates 1 32 1 32 1 32 1’ 3’2’ 1’ 2’3’ 1’ 2’3’ Reflection about x axis Reflection about y axis Reflection about origin Reflection (2/3) R 1 0 0 0 1 0 0 0 1 y            R 1 0 0 0 1 0 0 0 1 X                          100 010 001 R0
  • 35. Reflection (3/3)  Reflection through arbitrary point P (xr, yr) • translate point p to origin : Tr • perform reflection about origin : Ro • retranslate to original position : Tr  Reflection through y=x line                                   100 y10 x01 100 010 001 100 y10 x01 r r r r 0 1 0 1 0 0 0 0 1          
  • 36.
  • 37. Reflection through an arbitrary line y=Lx+b
  • 38. Shear Transformation  Shear : distorts the shape of an object  Shear transformation that distorts the shape of an object such that the transformed shape appears as if the object were composed of internal layers that had been caused to slide over each other.  Shearing (slide over) can be in either x or y direction  In X Shear, x-values changes along x-direction by shearing factor of shx • point is shifted by horizontally by an amount proportional to its distance from x-axis • y values are unchanged  In Y Shear, y-values changes along y-direction by shearing factor of shy • point is shifted by vertically by an amount proportional to its distance from y-axis • x values are unchanged
  • 40. Transformation matrix of X- Shear • So, • Transformed positions T 1 sh 0 0 1 0 0 0 1 shx x            x' x sh yx   , y' y
  • 41. X –Shear relative to y- reference line
  • 42. Transformation matrix of X- Shear with y- reference line  X-direction shearing relative to liney yref 1 sh sh y 0 1 0 0 0 1 x x ref          yy' )y(yshxx' refx  
  • 44. Y – Shear relative to x reference line  y-direction shearing relative to linex xref 1 0 0 sh 1 sh x 0 0 1 y y ref           x' x y' y sh (x x )y ref    
  • 45.
  • 46.  The area of the parallelogram can be calculated as,  Area of the trapezium =(sum of two parallel side)*h / 2  Parea = (a+c) (b+d) – (ab) – (cd) – (b+b+d) – (c+a+c) = ad – bc = det  Thus, area of any parallelogram is formed by transforming a square which is a function of the transformation matrix determinant and is related to the area of the initial square Parea = Sarea (ad-bc) = Sarea det [T]  Area of any transformed figure Tarea is related to the ar ea of the initial figure Iarea by, Tarea = Iarea (ad-bc) 2 1 2 1 2 c 2 b       dc ba
  • 47. WINDOW TO VIEW PORT TRANSFORMATION
  • 48.
  • 49.
  • 50.
  • 51. ASSIGNMENT -2 TWO –D TRANSFORMATION Assigned Date : 26-02-13 Submission Date : 05-03-13  Fo r a l l t h e b e l o w g i v e n pr o b l e m Or i g i n a l a n d Fi n a l po s i t i o n d i a g r a m i s n e c e s s a r y 1. Scale a square at [(2, 2), (6, 6)] along one of its diagonal and find the new vertices. 2. Perform a clockwise 30 degree rotation of a triangle A (2, 3), B (5, 5), C(4,3) about the point (1,1) 3. Find a transformation of triangle A (1, 0), B (0, 1), C (1, 1) by a) Rotating 30 degree about the origin and then translating one unit in x and y direction. b) Translating one unit in x and y direction and then rotating 30 degree about the origin. 4. Represent a triangle at [(3, 3), (5, 6) , (7,3) ] in a new coordinate system with origin at (3,3) and its x-axis making an angle +45 degree with the x-direction of the base coordinate system. 5. Find out the co-ordinate of a figure bounded by (0,0) , (1,5) , (6,3) (- 3,-4) when reflected along the line whose equation is y=1 (x+5) and sheared by 2 units in x –direction and 2 units in y-direction. [HINT: Ref -Page No. 3-46 in Godse Book] 6. Compute the new reflected coordinates of a point (-4,-4), when reflected with respect to a line that passes through (-4, 0) and (0,-4) [HINT: Ref -Page No. 3-62 in Godse Book] 7. For a point (2, 4) in a window at [(1, 1), (5, 5)], find the equivalent point in the View Port at [(1, 1), (5, 10)].