SlideShare a Scribd company logo
1 of 41
Amity Institute of Information Technology
AIIT
COMPUTER GRAPHICS
Two Dimensional Geometric
Transformation
AMITY UNIVERSITY, NOIDA
INDIA
Amity Institute of Information Technology
AIIT
Contents
– Why transformations
– Transformations
• Translation
• Scaling
• Rotation
• Reflection
• Shearing
– Homogeneous coordinates
– Combining transformations
Amity Institute of Information Technology
AIIT
Transformations
• In graphics, once we have an object described,
transformations are used to move that object, scale it
and rotate it The process of change in size,orientation
or positions of objects by a mathematical operation is
called Transformation.
Amity Institute of Information Technology
AIIT
Types of Transformation
1) Geometric Transformations: In this type of
transformations, the object itself is moved relative to
a stationary coordinate system or background.
2) Coordinate Transformations: In this type of
transformation, the object is held stationary while the
coordinate system is moved relative to the object.
Amity Institute of Information Technology
AIIT
Cartesian Coordinate System
• A number line can be used to represent a number or solution of an
equation that only has one variable. It is sufficient to describe the
solution of one-valued equations because they all are single-
dimensional.
• But as the number of variables in an equation increases, it is not
enough. For example when the number of variables in an
equation becomes two, there will be pair of numbers as a solution.
This is why the concept of the number line has to be extended.
There should be 2 number lines now, but how will we show our
solution on it?
• So, instead of a line, let’s define a plane to plot the solutions now.
Amity Institute of Information Technology
AIIT
Cartesian Plane and Coordinates
• Cartesian Plane:
• A Cartesian plane is defined by two perpendicular number lines, X
and Y. It extends to infinity in both directions. It has a centre
usually denoted by O.
• The horizontal line is called X-axis while the vertical line is
called Y-axis.
• Cartesian Coordinates:
• Cartesian Coordinates are used to mark the plane about a point.
How far up/down or how far left/right it is.
• They are always written in a certain order:
• Horizontal distance
• Vertical Distance
• This is called an “ordered pair” (a pair of numbers in a special
order) and usually, the numbers are separated by a comma, and
parentheses are put around the whole thing like (5,4).
Amity Institute of Information Technology
AIIT
Types of Transformation
1. Translation
2. Scaling
3. Rotation
4. Reflection
5. Shearing
Amity Institute of Information Technology
AIIT
Translation
• Simply moves an object from one position to another
• xnew = xold + tx ynew = yold + ty
• The pair (tx , ty) is called translation vector or shift vector
Note: House shifts position relative to origin
y
x
0
1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6
Amity Institute of Information Technology
AIIT
Translation Example
y
x
0 1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6
(1, 1) (3, 1)
(2, 3)
(6, 4)
tx
(7, 2)
(5, 2)
=4
=1
ty
Amity Institute of Information Technology
AIIT
• In matrix representation we can write translation as
Amity Institute of Information Technology
AIIT
Rotation
Rotates all coordinates by a specified angle
• xnew = xold × cosθ – yold × sinθ
• ynew = xold × sinθ + yold × cosθ
• Points are always rotated about the origin
• The convention is that the direction of rotation is
counterclockwise if θ is positive angle and clockwise if θ is
negative angle y
x
0
1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6
Amity Institute of Information Technology
AIIT
• Rotation can be represented as:
Amity Institute of Information Technology
AIIT
Scaling
• Scalar multiplies all coordinates
• WATCH OUT: Objects grow and move!
• xnew = Sx × xold ynew = Sy × yold
• The pair (Sx , Sy) is called Scaling vector
Note: House shifts position relative to origin
y
x
0
1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6
Amity Institute of Information Technology
AIIT
Scaling Example
y
0 1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6
(1, 1) (3, 1)
(2, 3)
Scaling vectors=(2,2)
Amity Institute of Information Technology
AIIT
Scaling transformation can be represented as
Amity Institute of Information Technology
AIIT
Reflection and Shearing
Amity Institute of Information Technology
AIIT
Reflection
• A reflection is a transformation that produces a mirror image
of an object relative to an axis of reflection. We can choose an
axis of reflection in the xy plane or perpendicular to the xy
plane.
Y
X
O
Original
object
Reflected
object
Amity Institute of Information Technology
AIIT
Reflection Transformation matrix
Reflection about
Y-axis
-1 0 0
0 1 0
0 0 1
Reflection about
X-axis
1 0 0
0 -1 0
0 0 1
Reflection about
origin
-1 0 0
0 -1 0
0 0 1
Reflection about diagonal axis (line
y=x)
0 1 0
1 0 0
0 0 1
Reflection about
Line y = - x
0 -1 0
- 1 0 0
0 0 1
Amity Institute of Information Technology
AIIT
Shearing
• A transformation that slants the shape of an object is called the
shear transformation.
• Two common shearing transformations are
– X-shear
– Y-shear
X-Shear
• The X shear preserves the y coordinates, but changes the x
values which causes vertical lines to tilt right or left.
Amity Institute of Information Technology
AIIT
Y Shear
• The Y shear preserves the x coordinates, but changes
the y values which causes horizontal lines to tilt up or
down.
Amity Institute of Information Technology
AIIT
Inverse Geometric Transformation
• Each geometric transformation has an inverse which is
described by the opposite operation performed by the
transformation.
Amity Institute of Information Technology
AIIT
Homogeneous Coordinates
Amity Institute of Information Technology
AIIT
Homogeneous Coordinates
• To express any two-dimensional transformation as a matrix
multiplication, we represent each Cartesian coordinate position
(x,y) with the homogeneous coordinate triple(xh,yh,h) where
x = xh/ h y= yh /h
• But it is convenient to have h = 1. Therefore, each two-
dimensional position can be represented with homogenous
coordinate as (x, y, 1).
• Other values for parameter h are needed in matrix formulations
of 3-D viewing transformations.
• Expressing positions in homogeneous coordinates allows us to
represent all geometric transformation equations as matrix
multiplication.
• Coordinates are represented with three-element column
vectors,and tranformation operations are written as 3 by 3
matrices.
Amity Institute of Information Technology
AIIT
Composite Transformation
• A Composite Transformation is a transformation that consists
of more than one step to the transformation.
• For example, translate an object and then, do a second
translation on the product, to again move the object.
• There can be a combination of two different transformations.
For example, translate the object and then perform a size
transformation.
Amity Institute of Information Technology
AIIT
Numerical 1
• Find the matrix that represents rotation of an object by
30 degree about the origin
• What are the new coordinates of the point P(2,-4) after
the rotation.
Amity Institute of Information Technology
AIIT
Numerical 2
• Q) Translate a point P (2,5) by 3 units in x direction
and 4 units in Y direction.
Amity Institute of Information Technology
AIIT
Numerical 3
• Translate a polygon with coordinates A(2,5) B(7,10)
and C(10, 2) by 3 units in X direction and 4 units in Y
direction.
Amity Institute of Information Technology
AIIT
Numerical 4
• Find the transformation that scales (w.r.t origin) by
(i) a units in x direction
(ii) b units in y direction
(iii) a units in the x direction and b units in the y direction
Amity Institute of Information Technology
AIIT
Numerical 5
• Q) Scale the polygon with coordinates A(2,5) B(7,10)
and C(10,2) by two units in X direction and two units in
Y direction.
Amity Institute of Information Technology
AIIT
General Pivot Point Rotation
1) Translate the object so that the pivot-point position is
moved to the coordinate origin.
2). Rotate the object about the coordinate origin.
3).Translate the object so that the pivot point is returned
to its original position.
Amity Institute of Information Technology
AIIT
General Fixed Point Scaling
• Translate object so that the fixed point coincides with
the coordinate origin.
• Scale the object with respect to the coordinate origin.
• Use the inverse translation of step 1 to return the
object to its original position.
Amity Institute of Information Technology
AIIT
Numerical 6
• Perform a 45 degree rotation A(0,0), B(1,1) , C(5,2)
a) About the origin b) About P(-1,-1).
Amity Institute of Information Technology
AIIT
Numerical 7
• Q) Prove that two successive 2D rotations are additive.
Amity Institute of Information Technology
AIIT
Numerical 8
• Magnify a triangle with vertices A (0,0), B(1,1) and
C(5,2) to twice its size while keeping C(5,2) fixed.
Amity Institute of Information Technology
AIIT
Numerical 9
• Find a transformation of triangle A(1,0), B(0,1), C(1,1)
by rotating 45 degree about the origin and then
translating one unit in x and y direction.
Amity Institute of Information Technology
AIIT
Numerical 10
Q) Apply the shearing transformation to square with
A(0,0), B(1,0), C(1,1) and D(0,1) as given below:
(a) Shear Parameter value of 0.5 relative to the line
Yref=-1
(b) Shear Parameter value of 0.5 relative to the line
Xref=-1
Amity Institute of Information Technology
AIIT
Numerical 12
• Describe the transformation that rotates an object point
Q(x,y) θ degree about a fixed center of rotation p(h,k),
and find the matrix for rotation about a point p(h,k)
Amity Institute of Information Technology
AIIT
Numerical 13
• Reflect the diamond shaped polygon whose vertices
are A(-1,0), B(0,-2), C(1,0) and D(0,2) about
(a) The horizontal line y=2
(b) The vertical line x=2
(c) The line y=x+2
Amity Institute of Information Technology
AIIT
Solution
Amity Institute of Information Technology
AIIT
Amity Institute of Information Technology
AIIT
THANK YOU

More Related Content

Similar to Module 4.pptx

module 3 ppt2 (1).pptx
module 3 ppt2 (1).pptxmodule 3 ppt2 (1).pptx
module 3 ppt2 (1).pptxRADHIKAB20
 
affine transformation for computer graphics
affine transformation for computer graphicsaffine transformation for computer graphics
affine transformation for computer graphicsDrSUGANYADEVIK
 
Transformational geometry
Transformational geometryTransformational geometry
Transformational geometryNeil_Plays
 
2D- Transformation
2D- Transformation2D- Transformation
2D- Transformationnehrurevathy
 
Matrix of linear transformation 1.9-dfs
Matrix of linear transformation 1.9-dfsMatrix of linear transformation 1.9-dfs
Matrix of linear transformation 1.9-dfsFarhana Shaheen
 
Geometric transformations and projections
Geometric transformations and projectionsGeometric transformations and projections
Geometric transformations and projectionsJaya Teja
 
Two dimensionaltransformations
Two dimensionaltransformationsTwo dimensionaltransformations
Two dimensionaltransformationsNareek
 
Unit-3 overview of transformations
Unit-3 overview of transformationsUnit-3 overview of transformations
Unit-3 overview of transformationsAmol Gaikwad
 
moule 3 ppt1 basic 2D transformations.pptx
moule 3 ppt1 basic 2D transformations.pptxmoule 3 ppt1 basic 2D transformations.pptx
moule 3 ppt1 basic 2D transformations.pptxRADHIKAB20
 
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.pptxKhalil Alhatab
 
Transformations in Computer Graphics
Transformations in Computer GraphicsTransformations in Computer Graphics
Transformations in Computer GraphicsJatenderKhatri
 
Part 2- Transformation.pptx
Part 2- Transformation.pptxPart 2- Transformation.pptx
Part 2- Transformation.pptxKhalil Alhatab
 
Exploring transformations and parent graphs
Exploring transformations and parent graphsExploring transformations and parent graphs
Exploring transformations and parent graphsAlaina Wright
 
Computer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2DComputer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2D2013901097
 
Part 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptxPart 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptxKhalil Alhatab
 
Two dimentional transform
Two dimentional transformTwo dimentional transform
Two dimentional transformPatel Punit
 

Similar to Module 4.pptx (20)

module 3 ppt2 (1).pptx
module 3 ppt2 (1).pptxmodule 3 ppt2 (1).pptx
module 3 ppt2 (1).pptx
 
affine transformation for computer graphics
affine transformation for computer graphicsaffine transformation for computer graphics
affine transformation for computer graphics
 
september4.ppt
september4.pptseptember4.ppt
september4.ppt
 
Transformational geometry
Transformational geometryTransformational geometry
Transformational geometry
 
2D- Transformation
2D- Transformation2D- Transformation
2D- Transformation
 
Matrix of linear transformation 1.9-dfs
Matrix of linear transformation 1.9-dfsMatrix of linear transformation 1.9-dfs
Matrix of linear transformation 1.9-dfs
 
Geometric transformations and projections
Geometric transformations and projectionsGeometric transformations and projections
Geometric transformations and projections
 
Two dimensionaltransformations
Two dimensionaltransformationsTwo dimensionaltransformations
Two dimensionaltransformations
 
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
 
moule 3 ppt1 basic 2D transformations.pptx
moule 3 ppt1 basic 2D transformations.pptxmoule 3 ppt1 basic 2D transformations.pptx
moule 3 ppt1 basic 2D transformations.pptx
 
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
 
Transformations in Computer Graphics
Transformations in Computer GraphicsTransformations in Computer Graphics
Transformations in Computer Graphics
 
Part 2- Transformation.pptx
Part 2- Transformation.pptxPart 2- Transformation.pptx
Part 2- Transformation.pptx
 
Exploring transformations and parent graphs
Exploring transformations and parent graphsExploring transformations and parent graphs
Exploring transformations and parent graphs
 
Computer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2DComputer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2D
 
Computer Graphics - transformations in 2d
Computer Graphics - transformations in 2dComputer Graphics - transformations in 2d
Computer Graphics - transformations in 2d
 
transformation IT.ppt
transformation IT.ppttransformation IT.ppt
transformation IT.ppt
 
Part 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptxPart 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptx
 
Two dimentional transform
Two dimentional transformTwo dimentional transform
Two dimentional transform
 

Recently uploaded

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 

Recently uploaded (20)

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 

Module 4.pptx

  • 1. Amity Institute of Information Technology AIIT COMPUTER GRAPHICS Two Dimensional Geometric Transformation AMITY UNIVERSITY, NOIDA INDIA
  • 2. Amity Institute of Information Technology AIIT Contents – Why transformations – Transformations • Translation • Scaling • Rotation • Reflection • Shearing – Homogeneous coordinates – Combining transformations
  • 3. Amity Institute of Information Technology AIIT Transformations • In graphics, once we have an object described, transformations are used to move that object, scale it and rotate it The process of change in size,orientation or positions of objects by a mathematical operation is called Transformation.
  • 4. Amity Institute of Information Technology AIIT Types of Transformation 1) Geometric Transformations: In this type of transformations, the object itself is moved relative to a stationary coordinate system or background. 2) Coordinate Transformations: In this type of transformation, the object is held stationary while the coordinate system is moved relative to the object.
  • 5. Amity Institute of Information Technology AIIT Cartesian Coordinate System • A number line can be used to represent a number or solution of an equation that only has one variable. It is sufficient to describe the solution of one-valued equations because they all are single- dimensional. • But as the number of variables in an equation increases, it is not enough. For example when the number of variables in an equation becomes two, there will be pair of numbers as a solution. This is why the concept of the number line has to be extended. There should be 2 number lines now, but how will we show our solution on it? • So, instead of a line, let’s define a plane to plot the solutions now.
  • 6. Amity Institute of Information Technology AIIT Cartesian Plane and Coordinates • Cartesian Plane: • A Cartesian plane is defined by two perpendicular number lines, X and Y. It extends to infinity in both directions. It has a centre usually denoted by O. • The horizontal line is called X-axis while the vertical line is called Y-axis. • Cartesian Coordinates: • Cartesian Coordinates are used to mark the plane about a point. How far up/down or how far left/right it is. • They are always written in a certain order: • Horizontal distance • Vertical Distance • This is called an “ordered pair” (a pair of numbers in a special order) and usually, the numbers are separated by a comma, and parentheses are put around the whole thing like (5,4).
  • 7. Amity Institute of Information Technology AIIT Types of Transformation 1. Translation 2. Scaling 3. Rotation 4. Reflection 5. Shearing
  • 8. Amity Institute of Information Technology AIIT Translation • Simply moves an object from one position to another • xnew = xold + tx ynew = yold + ty • The pair (tx , ty) is called translation vector or shift vector Note: House shifts position relative to origin y x 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6
  • 9. Amity Institute of Information Technology AIIT Translation Example y x 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6 (1, 1) (3, 1) (2, 3) (6, 4) tx (7, 2) (5, 2) =4 =1 ty
  • 10. Amity Institute of Information Technology AIIT • In matrix representation we can write translation as
  • 11. Amity Institute of Information Technology AIIT Rotation Rotates all coordinates by a specified angle • xnew = xold × cosθ – yold × sinθ • ynew = xold × sinθ + yold × cosθ • Points are always rotated about the origin • The convention is that the direction of rotation is counterclockwise if θ is positive angle and clockwise if θ is negative angle y x 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6
  • 12. Amity Institute of Information Technology AIIT • Rotation can be represented as:
  • 13. Amity Institute of Information Technology AIIT Scaling • Scalar multiplies all coordinates • WATCH OUT: Objects grow and move! • xnew = Sx × xold ynew = Sy × yold • The pair (Sx , Sy) is called Scaling vector Note: House shifts position relative to origin y x 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6
  • 14. Amity Institute of Information Technology AIIT Scaling Example y 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6 (1, 1) (3, 1) (2, 3) Scaling vectors=(2,2)
  • 15. Amity Institute of Information Technology AIIT Scaling transformation can be represented as
  • 16. Amity Institute of Information Technology AIIT Reflection and Shearing
  • 17. Amity Institute of Information Technology AIIT Reflection • A reflection is a transformation that produces a mirror image of an object relative to an axis of reflection. We can choose an axis of reflection in the xy plane or perpendicular to the xy plane. Y X O Original object Reflected object
  • 18. Amity Institute of Information Technology AIIT Reflection Transformation matrix Reflection about Y-axis -1 0 0 0 1 0 0 0 1 Reflection about X-axis 1 0 0 0 -1 0 0 0 1 Reflection about origin -1 0 0 0 -1 0 0 0 1 Reflection about diagonal axis (line y=x) 0 1 0 1 0 0 0 0 1 Reflection about Line y = - x 0 -1 0 - 1 0 0 0 0 1
  • 19. Amity Institute of Information Technology AIIT Shearing • A transformation that slants the shape of an object is called the shear transformation. • Two common shearing transformations are – X-shear – Y-shear X-Shear • The X shear preserves the y coordinates, but changes the x values which causes vertical lines to tilt right or left.
  • 20. Amity Institute of Information Technology AIIT Y Shear • The Y shear preserves the x coordinates, but changes the y values which causes horizontal lines to tilt up or down.
  • 21. Amity Institute of Information Technology AIIT Inverse Geometric Transformation • Each geometric transformation has an inverse which is described by the opposite operation performed by the transformation.
  • 22. Amity Institute of Information Technology AIIT Homogeneous Coordinates
  • 23. Amity Institute of Information Technology AIIT Homogeneous Coordinates • To express any two-dimensional transformation as a matrix multiplication, we represent each Cartesian coordinate position (x,y) with the homogeneous coordinate triple(xh,yh,h) where x = xh/ h y= yh /h • But it is convenient to have h = 1. Therefore, each two- dimensional position can be represented with homogenous coordinate as (x, y, 1). • Other values for parameter h are needed in matrix formulations of 3-D viewing transformations. • Expressing positions in homogeneous coordinates allows us to represent all geometric transformation equations as matrix multiplication. • Coordinates are represented with three-element column vectors,and tranformation operations are written as 3 by 3 matrices.
  • 24. Amity Institute of Information Technology AIIT Composite Transformation • A Composite Transformation is a transformation that consists of more than one step to the transformation. • For example, translate an object and then, do a second translation on the product, to again move the object. • There can be a combination of two different transformations. For example, translate the object and then perform a size transformation.
  • 25. Amity Institute of Information Technology AIIT Numerical 1 • Find the matrix that represents rotation of an object by 30 degree about the origin • What are the new coordinates of the point P(2,-4) after the rotation.
  • 26. Amity Institute of Information Technology AIIT Numerical 2 • Q) Translate a point P (2,5) by 3 units in x direction and 4 units in Y direction.
  • 27. Amity Institute of Information Technology AIIT Numerical 3 • Translate a polygon with coordinates A(2,5) B(7,10) and C(10, 2) by 3 units in X direction and 4 units in Y direction.
  • 28. Amity Institute of Information Technology AIIT Numerical 4 • Find the transformation that scales (w.r.t origin) by (i) a units in x direction (ii) b units in y direction (iii) a units in the x direction and b units in the y direction
  • 29. Amity Institute of Information Technology AIIT Numerical 5 • Q) Scale the polygon with coordinates A(2,5) B(7,10) and C(10,2) by two units in X direction and two units in Y direction.
  • 30. Amity Institute of Information Technology AIIT General Pivot Point Rotation 1) Translate the object so that the pivot-point position is moved to the coordinate origin. 2). Rotate the object about the coordinate origin. 3).Translate the object so that the pivot point is returned to its original position.
  • 31. Amity Institute of Information Technology AIIT General Fixed Point Scaling • Translate object so that the fixed point coincides with the coordinate origin. • Scale the object with respect to the coordinate origin. • Use the inverse translation of step 1 to return the object to its original position.
  • 32. Amity Institute of Information Technology AIIT Numerical 6 • Perform a 45 degree rotation A(0,0), B(1,1) , C(5,2) a) About the origin b) About P(-1,-1).
  • 33. Amity Institute of Information Technology AIIT Numerical 7 • Q) Prove that two successive 2D rotations are additive.
  • 34. Amity Institute of Information Technology AIIT Numerical 8 • Magnify a triangle with vertices A (0,0), B(1,1) and C(5,2) to twice its size while keeping C(5,2) fixed.
  • 35. Amity Institute of Information Technology AIIT Numerical 9 • Find a transformation of triangle A(1,0), B(0,1), C(1,1) by rotating 45 degree about the origin and then translating one unit in x and y direction.
  • 36. Amity Institute of Information Technology AIIT Numerical 10 Q) Apply the shearing transformation to square with A(0,0), B(1,0), C(1,1) and D(0,1) as given below: (a) Shear Parameter value of 0.5 relative to the line Yref=-1 (b) Shear Parameter value of 0.5 relative to the line Xref=-1
  • 37. Amity Institute of Information Technology AIIT Numerical 12 • Describe the transformation that rotates an object point Q(x,y) θ degree about a fixed center of rotation p(h,k), and find the matrix for rotation about a point p(h,k)
  • 38. Amity Institute of Information Technology AIIT Numerical 13 • Reflect the diamond shaped polygon whose vertices are A(-1,0), B(0,-2), C(1,0) and D(0,2) about (a) The horizontal line y=2 (b) The vertical line x=2 (c) The line y=x+2
  • 39. Amity Institute of Information Technology AIIT Solution
  • 40. Amity Institute of Information Technology AIIT
  • 41. Amity Institute of Information Technology AIIT THANK YOU