SlideShare a Scribd company logo
1 of 52
Now Playing:
Gong
Sigur Rós
From Takk...
Released September 13, 2005
Andre and Wally B
(Lucasfilm CG
Project [later Pixar],
1984)
2D Transforms
Rick Skarbez, Instructor
COMP 575
September 4, 2007
• Reviewed the math we’re going to
use in this course
• Points
• Vectors
• Matrices
• Linear interpolation
• Rays, planes, etc.
Last Time
Today
• Vector spaces and coordinate frames
• Transforms in 2D
• Composing Transforms
Vector Spaces
• Let’s think for a minute about what x
and y coordinates really mean
y
(x,y)
x
i
j
(u,v)
x
y j
i
Vector Spaces
• For illustration, let’s flip things around
i
j
(u,v)
x
y j
i
x
y
(x,y)
= (-u,v)
Vector Spaces
• Any pair of non-parallel, non-anti-
parallel vectors can define a vector
space in 2D
• We’re used to thinking about spaces
defined by orthogonal, normalized,
axis-aligned vectors
• But there’s no reason this is the only
way to do things
Vector Space Terms
• Linear Vector Space: Any space made
up of vectors and scalars
• Euclidean Space: Vector space with a
distance metric
• Affine Space: Vector space with an
origin
• The Cartesian plane is both affine and
Euclidean
• We call this type of space a frame
2D Transforms
• What am I talking about when I say
“transforms”?
• Translation
(x,y)
(x’,y’)
• Scaling
• Rotation
General Form
• The transformations we consider are of
the following form:
Transformation
Matrix
• Remember that the transformation matrix
describes the change in vector space:
x
y
Object vs. World
Space
• Let’s stop and think about why we’re
doing this...
• We can define the points that make up
an object in “object space”
• Whatever is most convenient, often
centered around the origin
• Then, at run time, we can put the
objects where we want them in “world
space”
Object vs. World
Space
• Makes building large models easier
• Example:
Object Space
(x0,y0)
(x1,y1)
(x2,y2)
World Space
Translation
• Basically, just moving points
• In 2D, up, down, left, or right
• All points move in the same way
• For example, we may want to move all
points 4 pixels to the right and 3 down:
Object Space
(x,y)
World Space
(x+4,y-3)
So How Do We Do
It?
• What transformation matrix will add 4
to x and subtract 3 from y?
• That is, what are the values of a, b,
c, and d needed for this
transformation?
Transformation
Matrix
• Actually, this is impossible to do with a
2x2 matrix and 2-vectors
How Do We Do It?
• Option 1: Implement translation as a
2-step process
e is the x-offset
f is the y-offset
• What are the values for our example?
So How Do We Do
It?
• Option 2: Use bigger matrices
• If we set w = 1, then
c is the x-offset
f is the y-offset
How We Do It
• This is the way we’ll normally do it
• However, in computer science, we
really like square matrices, so it’ll be
written as:
So what does this w stand for?
Homogeneous
Coordinates
• We refer to this as a homogeneous
coordinate:
• This mathematical construct allows us to
• Represent affine transforms with a single
matrix
• Do calculations in projective space
(vectors are unique only up to scaling)
Homogeneous
Coordinates
• For points, w must be non-zero
• If w=1, the point is “normalized”
• If w!=1, can normalize by
Vectors in
Homogeneous
Coordinates
• Remember last time, I mentioned that
it would be useful that we could
represent points and vectors the same
way?
• Here’s the payoff
• Can use homogeneous coordinates to
represent vectors, too
• What is w?
• Remember, vectors don’t have a
Vectors in
Homogeneous
Coordinates
• Since vectors don’t have a position,
they should not be affected by
translation
• What about rotation/scaling?
• Set w=0 for vectors:
These have no effect
Summing up
Translation
• We will represent translation with a
matrix of the following form:
u is the x-offset
v is the y-offset
Scaling
• Want to stretch or shrink the entire
space in one or more dimensions
• α = stretch in x, β = stretch in y
x
y
Original
α=1, β=1
x
y
α=2, β=1
x
y
α=1, β=2
Scaling
• Scaling is centered around the origin
• Points either get pulled toward the
origin or pushed away from it
x
y
x
y
x
y
Scaling
• So, given what we know, how would we
construct a scaling matrix?
• Assume we have an object centered
around the origin, and want to scale it
by α in x, and β in y
• x’ = αx
• y’ = βy
Summing up Scaling
• We will represent scaling with a matrix
of the following form:
α is the scale factor in the x-direction
β is the scale factor in the y-direction
Rotation
α
α
Rotation
• Like scaling, rotations are centered
about the origin
x
y
x
y
x
y
Rotation
Summing up Rotation
• We will represent rotation with a matrix
of the following form:
α is the angle of rotation
(counter-clockwise)
Anything else?
• Translation, scaling, and rotation are
the three most common transforms
• What do they have in common?
• They maintain the orthogonality of the
coordinate frame
• What happens if we relax this
constraint?
Shearing
x
y
Horizontal
Shear
x
y
Original
x
y
Vertical
Shear
Shearing
Vertical Shear
x
y
Horizontal Shear y
x
s=0, No Shear
s=1, 45 Degree Shea
s is -tan(θ), where θ is the desired shear
angle
Transforms Summary
• Discussed how to do 4 common
transforms in 2D
• Translation
• Scaling
• Rotation
• Shearing
• Also took a detour to discuss
homogeneous coordinates
Composing
Transforms
• These are the basics
• However, single transforms aren’t really
very interesting
• The real power comes from using
multiple transforms simultaneously
• That’s what we’re going to do now
Composing
Transforms
• So why did we go through the trouble to
use homogeneous coordinates for our
points, and do our transforms using
square transformation matrices?
• To make composing transforms easy!
• Composing 2 transforms is just
multiplying the 2 transform matrices
together
WARNING: The order in which matrix multiplications
are performed may (and usually does) change the result!
(i.e. they are not commutative)
Let’s do an example
• Two transforms:
• Scale x and y by a factor of 2
• Translate points (+3, +2)
• Let’s pick a single point in object space
• (1, 2)
Two Transform Paths
x
y
(2,1)
Translate Then Scale
Two Transform Paths
x
y
(5,3)
(+3, +2)
Translate Then Scale
Two Transform Paths
x
y
(10, 6)
(*2, *2)
Translate Then Scale
Two Transform Paths
x
y
(2,1)
Scale Then Translate
Two Transform Paths
x
y
(4,2)
(*2, *2)
Scale Then Translate
Two Transform Paths
x
y
(7,4)
(+3, +2)
Scale Then Translate
Composing
Transforms
• Translate then scale
• (x’, y’) = (10, 6)
• Scale then translate
• (x’, y’) = (7, 4)
• Need a standard way to order
transforms!
Transform Matrix
Multiplications
• Always compose from right to left
• Here, transform M1 is applied first
• Transform M3 is applied last
Two Transform Paths
Translate then Scale
Two Transform Paths
Scale then Translate
Composing
Transforms
• We can go one step further than just
multiplying matrices
• Specifically, we can use a matrix stack
• This is what OpenGL and DirectX use
You can build it in
either order
(world to object
or object to
world),
then multiply out
when needed
Transform
Scale
Identity
Push Pop
Application: Rotation
about a non-origin
point
x
y
x
y
x
y
x
y
x
y
Robotic Arm Example
• Fingers first
• Then wrist
• Then elbow
• Finally,
shoulder
Next Time
• Going to talk a bit more about
transforms, and in particular, 3D
transforms
• Might talk a little bit about animation

More Related Content

Similar to september4.ppt

2 d transformations and homogeneous coordinates
2 d transformations and homogeneous coordinates2 d transformations and homogeneous coordinates
2 d transformations and homogeneous coordinatesTarun Gehlot
 
Harris corner detector and face recognition
Harris corner detector and face recognitionHarris corner detector and face recognition
Harris corner detector and face recognitionShih Wei Huang
 
Mesh Shape Editing
Mesh Shape EditingMesh Shape Editing
Mesh Shape Editingssuser24ddad
 
2D Transformation in Computer Graphics
2D Transformation in Computer Graphics2D Transformation in Computer Graphics
2D Transformation in Computer GraphicsA. S. M. Shafi
 
2.1 Functions and Their Graphs
2.1 Functions and Their Graphs2.1 Functions and Their Graphs
2.1 Functions and Their Graphshisema01
 
what_are_Derivative.pdf
what_are_Derivative.pdfwhat_are_Derivative.pdf
what_are_Derivative.pdfPatrickNokrek
 
2d transformations
2d transformations2d transformations
2d transformationskmrvivek2
 
07 cie552 image_mosaicing
07 cie552 image_mosaicing07 cie552 image_mosaicing
07 cie552 image_mosaicingElsayed Hemayed
 
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
 
Chapter3physics
Chapter3physicsChapter3physics
Chapter3physicsfurmannv
 
Transformations in Computer Graphics
Transformations in Computer GraphicsTransformations in Computer Graphics
Transformations in Computer GraphicsJatenderKhatri
 
AP Advantage: AP Calculus
AP Advantage: AP CalculusAP Advantage: AP Calculus
AP Advantage: AP CalculusShashank Patil
 
2.7 Piecewise Functions
2.7 Piecewise Functions2.7 Piecewise Functions
2.7 Piecewise Functionshisema01
 
Lesson10 transformational geometry
Lesson10 transformational geometryLesson10 transformational geometry
Lesson10 transformational geometryAcceleratedClasses
 

Similar to september4.ppt (20)

2 d transformations and homogeneous coordinates
2 d transformations and homogeneous coordinates2 d transformations and homogeneous coordinates
2 d transformations and homogeneous coordinates
 
CO3303-1 Lecture 2.ppt
CO3303-1 Lecture 2.pptCO3303-1 Lecture 2.ppt
CO3303-1 Lecture 2.ppt
 
Module 4.pptx
Module 4.pptxModule 4.pptx
Module 4.pptx
 
Harris corner detector and face recognition
Harris corner detector and face recognitionHarris corner detector and face recognition
Harris corner detector and face recognition
 
Mesh Shape Editing
Mesh Shape EditingMesh Shape Editing
Mesh Shape Editing
 
2D Transformation in Computer Graphics
2D Transformation in Computer Graphics2D Transformation in Computer Graphics
2D Transformation in Computer Graphics
 
2.1 Functions and Their Graphs
2.1 Functions and Their Graphs2.1 Functions and Their Graphs
2.1 Functions and Their Graphs
 
what_are_Derivative.pdf
what_are_Derivative.pdfwhat_are_Derivative.pdf
what_are_Derivative.pdf
 
2d Transformation.pdf
2d Transformation.pdf2d Transformation.pdf
2d Transformation.pdf
 
2d transformations
2d transformations2d transformations
2d transformations
 
2d transformations
2d transformations2d transformations
2d transformations
 
07 cie552 image_mosaicing
07 cie552 image_mosaicing07 cie552 image_mosaicing
07 cie552 image_mosaicing
 
Mk slides.ppt
Mk slides.pptMk slides.ppt
Mk slides.ppt
 
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
 
Chapter3physics
Chapter3physicsChapter3physics
Chapter3physics
 
Transformations in Computer Graphics
Transformations in Computer GraphicsTransformations in Computer Graphics
Transformations in Computer Graphics
 
AP Advantage: AP Calculus
AP Advantage: AP CalculusAP Advantage: AP Calculus
AP Advantage: AP Calculus
 
Lecture 2.1 2.2a bt
Lecture 2.1 2.2a btLecture 2.1 2.2a bt
Lecture 2.1 2.2a bt
 
2.7 Piecewise Functions
2.7 Piecewise Functions2.7 Piecewise Functions
2.7 Piecewise Functions
 
Lesson10 transformational geometry
Lesson10 transformational geometryLesson10 transformational geometry
Lesson10 transformational geometry
 

More from CharlesMatu2

The cause of ww1 happened 1914 this was after the the asssasination of Arc...
The  cause of ww1  happened  1914 this was after the the asssasination of Arc...The  cause of ww1  happened  1914 this was after the the asssasination of Arc...
The cause of ww1 happened 1914 this was after the the asssasination of Arc...CharlesMatu2
 
history_of_american_agriculture.ppt
history_of_american_agriculture.ppthistory_of_american_agriculture.ppt
history_of_american_agriculture.pptCharlesMatu2
 
Origin of Agriculture.ppt
Origin of Agriculture.pptOrigin of Agriculture.ppt
Origin of Agriculture.pptCharlesMatu2
 
History of Science and Technology.ppt
History of Science and Technology.pptHistory of Science and Technology.ppt
History of Science and Technology.pptCharlesMatu2
 
Lighting & Shading in OpenGL Non-Photorealistic Rendering.ppt
Lighting & Shading in OpenGL Non-Photorealistic Rendering.pptLighting & Shading in OpenGL Non-Photorealistic Rendering.ppt
Lighting & Shading in OpenGL Non-Photorealistic Rendering.pptCharlesMatu2
 
BBM3117 CAT 31ST.docx
BBM3117 CAT 31ST.docxBBM3117 CAT 31ST.docx
BBM3117 CAT 31ST.docxCharlesMatu2
 
Computer graphics.docx
Computer graphics.docxComputer graphics.docx
Computer graphics.docxCharlesMatu2
 
BIT4103 HUMAN COMPUTER INTERACTION CAT.docx
BIT4103 HUMAN COMPUTER INTERACTION CAT.docxBIT4103 HUMAN COMPUTER INTERACTION CAT.docx
BIT4103 HUMAN COMPUTER INTERACTION CAT.docxCharlesMatu2
 

More from CharlesMatu2 (18)

The cause of ww1 happened 1914 this was after the the asssasination of Arc...
The  cause of ww1  happened  1914 this was after the the asssasination of Arc...The  cause of ww1  happened  1914 this was after the the asssasination of Arc...
The cause of ww1 happened 1914 this was after the the asssasination of Arc...
 
AP Ch 1.ppt
AP Ch 1.pptAP Ch 1.ppt
AP Ch 1.ppt
 
history_of_american_agriculture.ppt
history_of_american_agriculture.ppthistory_of_american_agriculture.ppt
history_of_american_agriculture.ppt
 
Origin of Agriculture.ppt
Origin of Agriculture.pptOrigin of Agriculture.ppt
Origin of Agriculture.ppt
 
History of Science and Technology.ppt
History of Science and Technology.pptHistory of Science and Technology.ppt
History of Science and Technology.ppt
 
september11.ppt
september11.pptseptember11.ppt
september11.ppt
 
september13.ppt
september13.pptseptember13.ppt
september13.ppt
 
september18.ppt
september18.pptseptember18.ppt
september18.ppt
 
september6.ppt
september6.pptseptember6.ppt
september6.ppt
 
august23.ppt
august23.pptaugust23.ppt
august23.ppt
 
november6.ppt
november6.pptnovember6.ppt
november6.ppt
 
november29.ppt
november29.pptnovember29.ppt
november29.ppt
 
october9.ppt
october9.pptoctober9.ppt
october9.ppt
 
october23.ppt
october23.pptoctober23.ppt
october23.ppt
 
Lighting & Shading in OpenGL Non-Photorealistic Rendering.ppt
Lighting & Shading in OpenGL Non-Photorealistic Rendering.pptLighting & Shading in OpenGL Non-Photorealistic Rendering.ppt
Lighting & Shading in OpenGL Non-Photorealistic Rendering.ppt
 
BBM3117 CAT 31ST.docx
BBM3117 CAT 31ST.docxBBM3117 CAT 31ST.docx
BBM3117 CAT 31ST.docx
 
Computer graphics.docx
Computer graphics.docxComputer graphics.docx
Computer graphics.docx
 
BIT4103 HUMAN COMPUTER INTERACTION CAT.docx
BIT4103 HUMAN COMPUTER INTERACTION CAT.docxBIT4103 HUMAN COMPUTER INTERACTION CAT.docx
BIT4103 HUMAN COMPUTER INTERACTION CAT.docx
 

Recently uploaded

Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 

Recently uploaded (20)

Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 

september4.ppt

  • 1. Now Playing: Gong Sigur Rós From Takk... Released September 13, 2005
  • 2. Andre and Wally B (Lucasfilm CG Project [later Pixar], 1984)
  • 3. 2D Transforms Rick Skarbez, Instructor COMP 575 September 4, 2007
  • 4. • Reviewed the math we’re going to use in this course • Points • Vectors • Matrices • Linear interpolation • Rays, planes, etc. Last Time
  • 5. Today • Vector spaces and coordinate frames • Transforms in 2D • Composing Transforms
  • 6. Vector Spaces • Let’s think for a minute about what x and y coordinates really mean y (x,y) x i j (u,v) x y j i
  • 7. Vector Spaces • For illustration, let’s flip things around i j (u,v) x y j i x y (x,y) = (-u,v)
  • 8. Vector Spaces • Any pair of non-parallel, non-anti- parallel vectors can define a vector space in 2D • We’re used to thinking about spaces defined by orthogonal, normalized, axis-aligned vectors • But there’s no reason this is the only way to do things
  • 9. Vector Space Terms • Linear Vector Space: Any space made up of vectors and scalars • Euclidean Space: Vector space with a distance metric • Affine Space: Vector space with an origin • The Cartesian plane is both affine and Euclidean • We call this type of space a frame
  • 10. 2D Transforms • What am I talking about when I say “transforms”? • Translation (x,y) (x’,y’) • Scaling • Rotation
  • 11. General Form • The transformations we consider are of the following form: Transformation Matrix • Remember that the transformation matrix describes the change in vector space: x y
  • 12. Object vs. World Space • Let’s stop and think about why we’re doing this... • We can define the points that make up an object in “object space” • Whatever is most convenient, often centered around the origin • Then, at run time, we can put the objects where we want them in “world space”
  • 13. Object vs. World Space • Makes building large models easier • Example: Object Space (x0,y0) (x1,y1) (x2,y2) World Space
  • 14. Translation • Basically, just moving points • In 2D, up, down, left, or right • All points move in the same way • For example, we may want to move all points 4 pixels to the right and 3 down: Object Space (x,y) World Space (x+4,y-3)
  • 15. So How Do We Do It? • What transformation matrix will add 4 to x and subtract 3 from y? • That is, what are the values of a, b, c, and d needed for this transformation? Transformation Matrix • Actually, this is impossible to do with a 2x2 matrix and 2-vectors
  • 16. How Do We Do It? • Option 1: Implement translation as a 2-step process e is the x-offset f is the y-offset • What are the values for our example?
  • 17. So How Do We Do It? • Option 2: Use bigger matrices • If we set w = 1, then c is the x-offset f is the y-offset
  • 18. How We Do It • This is the way we’ll normally do it • However, in computer science, we really like square matrices, so it’ll be written as: So what does this w stand for?
  • 19. Homogeneous Coordinates • We refer to this as a homogeneous coordinate: • This mathematical construct allows us to • Represent affine transforms with a single matrix • Do calculations in projective space (vectors are unique only up to scaling)
  • 20. Homogeneous Coordinates • For points, w must be non-zero • If w=1, the point is “normalized” • If w!=1, can normalize by
  • 21. Vectors in Homogeneous Coordinates • Remember last time, I mentioned that it would be useful that we could represent points and vectors the same way? • Here’s the payoff • Can use homogeneous coordinates to represent vectors, too • What is w? • Remember, vectors don’t have a
  • 22. Vectors in Homogeneous Coordinates • Since vectors don’t have a position, they should not be affected by translation • What about rotation/scaling? • Set w=0 for vectors: These have no effect
  • 23. Summing up Translation • We will represent translation with a matrix of the following form: u is the x-offset v is the y-offset
  • 24. Scaling • Want to stretch or shrink the entire space in one or more dimensions • α = stretch in x, β = stretch in y x y Original α=1, β=1 x y α=2, β=1 x y α=1, β=2
  • 25. Scaling • Scaling is centered around the origin • Points either get pulled toward the origin or pushed away from it x y x y x y
  • 26. Scaling • So, given what we know, how would we construct a scaling matrix? • Assume we have an object centered around the origin, and want to scale it by α in x, and β in y • x’ = αx • y’ = βy
  • 27. Summing up Scaling • We will represent scaling with a matrix of the following form: α is the scale factor in the x-direction β is the scale factor in the y-direction
  • 29. Rotation • Like scaling, rotations are centered about the origin x y x y x y
  • 31. Summing up Rotation • We will represent rotation with a matrix of the following form: α is the angle of rotation (counter-clockwise)
  • 32. Anything else? • Translation, scaling, and rotation are the three most common transforms • What do they have in common? • They maintain the orthogonality of the coordinate frame • What happens if we relax this constraint?
  • 34. Shearing Vertical Shear x y Horizontal Shear y x s=0, No Shear s=1, 45 Degree Shea s is -tan(θ), where θ is the desired shear angle
  • 35. Transforms Summary • Discussed how to do 4 common transforms in 2D • Translation • Scaling • Rotation • Shearing • Also took a detour to discuss homogeneous coordinates
  • 36. Composing Transforms • These are the basics • However, single transforms aren’t really very interesting • The real power comes from using multiple transforms simultaneously • That’s what we’re going to do now
  • 37. Composing Transforms • So why did we go through the trouble to use homogeneous coordinates for our points, and do our transforms using square transformation matrices? • To make composing transforms easy! • Composing 2 transforms is just multiplying the 2 transform matrices together WARNING: The order in which matrix multiplications are performed may (and usually does) change the result! (i.e. they are not commutative)
  • 38. Let’s do an example • Two transforms: • Scale x and y by a factor of 2 • Translate points (+3, +2) • Let’s pick a single point in object space • (1, 2)
  • 40. Two Transform Paths x y (5,3) (+3, +2) Translate Then Scale
  • 41. Two Transform Paths x y (10, 6) (*2, *2) Translate Then Scale
  • 43. Two Transform Paths x y (4,2) (*2, *2) Scale Then Translate
  • 44. Two Transform Paths x y (7,4) (+3, +2) Scale Then Translate
  • 45. Composing Transforms • Translate then scale • (x’, y’) = (10, 6) • Scale then translate • (x’, y’) = (7, 4) • Need a standard way to order transforms!
  • 46. Transform Matrix Multiplications • Always compose from right to left • Here, transform M1 is applied first • Transform M3 is applied last
  • 48. Two Transform Paths Scale then Translate
  • 49. Composing Transforms • We can go one step further than just multiplying matrices • Specifically, we can use a matrix stack • This is what OpenGL and DirectX use You can build it in either order (world to object or object to world), then multiply out when needed Transform Scale Identity Push Pop
  • 50. Application: Rotation about a non-origin point x y x y x y x y x y
  • 51. Robotic Arm Example • Fingers first • Then wrist • Then elbow • Finally, shoulder
  • 52. Next Time • Going to talk a bit more about transforms, and in particular, 3D transforms • Might talk a little bit about animation