Geometric Transformations

Geometric Transformations

Lecture 2: Geometric Transformation Yuhao Zhu CSC 292/572, Fall 2020 http://yuhaozhu.com Mobile Visual Computing Logistics ‣ Written assignment 0 is up and is due Sept. 2 11:30 AM. ‣ Course schedule: https://www.cs.rochester.edu/courses/572/fall2020/ schedule.html. You will find reading assignments and slides. ‣ Don’t forget to sign up for the news flash presentation. Link sent in BB. ‣ Come and introduce yourself in the first 2 weeks during my office hour. ‣ Start thinking and talking to me about your final project idea. !2 Geometric Transformation ‣ Perhaps the single most important math for this course and for understanding all visual computing applications. ‣ This lecture is an introduction and overview of the concepts that will be used in later lectures, not a systematic treatment of geometric transformation. ‣ Assumes basic understanding of linear algebra. A nice and gentle introduction to linear algebra could be found in Chapter 5 of Fundamentals of Computer Graphics (log in using your UR NetID). ‣ Required reading: Chapter 6 of Fundamentals of Computer Graphics. !3 Geometric Transformation: What Is It? Scaling Rotation Shearing Translation There are many more: reflection, dilation, projection, etc. https://www.ck12.org/geometry/translations/lesson/Geometric-Translations-BSC-GEOM/ FCG 4e !4 Geometric Transformation: What Is It? ‣ Change the position of all the points in the space in the same way. ‣ A point P [x, y, z]. Think of it as a 1x3 matrix ‣ Transformation: change P [x, y, z] to P’ [x’, y’, z’] ‣ Mathematically, transforming P to P’ is multiplying P with a 3x3 matrix T. ‣ Different transformations require different matrices. T00, T01, T02 [ [x, y, z] x = [x’, y’, z’] [ T10, T11, T12 T20, T21, T22 !5 Point Transformation using Matrix Multiplication ‣ What should T be like if we want to keep x the same before and after the transformation — regardless of where P [x, y, z] is. x’ = xT00 + yT10 + zT20 = x, for ∀ x, y, z T00, T01, T02 [ [x, y, z] x = [x’, y’, z’] [ T10, T11, T12 T20, T21, T22 !6 Point Transformation using Matrix Multiplication ‣ What should T be like if we want to keep x the same before and after the transformation — regardless of where P [x, y, z] is. x’ = xT00 + yT10 + zT20 = x, for ∀ x, y, z 1 0 0 T100 , T01, T02 [ [x, y, z] x = [x’, y’, z’] [ T010 , T11, T12 T020, T21, T22 !6 Point Transformation using Matrix Multiplication ‣ What should T be like if we want to keep y the same before and after the transformation — regardless of where P [x, y, z] is. y’ = xT01 + yT11 + zT21 = y, for ∀ x, y, z 0 1 0 T00, T001 , T02 [ [x, y, z] x = [x’, y’, z’] [ T10, T111 , T12 T20, T021, T22 !7 Point Transformation using Matrix Multiplication ‣ What should T be like if we want to keep z the same before and after the transformation — regardless of where P [x, y, z] is. z’ = xT02 + yT12 + zT22 = z, for ∀ x, y, z 0 0 1 T00, T01, T002 [ [x, y, z] x = [x’, y’, z’] [ T10, T11, T012 T20, T21, T122 !8 Identity Matrix ‣ What should T be like if we want to keep a point unchanged before and after the transformation — regardless of where P [x, y, z] is? ‣ That matrix is called the identity matrix T100 , T001 , T002 [ [x, y, z] x = [x’, y’, z’] [ T010 , T111 , T012 T020, T021, T122 !9 Scaling ‣ Changing from P [x, y, z] to P’ [S0·x, S1·y, S2·z] ‣ The “scaling factor”: [S0, S1, S2] ‣ How should the transformation matrix look like? [ T00, T01, T02 [ [x, y, z] x = [x’, y’, z’] [ T10, T11, T12 T20, T21, T22 !10 Scaling ‣ Changing from P [x, y, z] to P’ [S0·x, S1·y, S2·z] ‣ The “scaling factor”: [S0, S1, S2] ‣ How should the transformation matrix look like? x’ = xT00 + yT10 + zT20 = S0x [ T00, T01, T02 [ [x, y, z] x = [x’, y’, z’] [ T10, T11, T12 T20, T21, T22 !10 Scaling ‣ Changing from P [x, y, z] to P’ [S0·x, S1·y, S2·z] ‣ The “scaling factor”: [S0, S1, S2] ‣ How should the transformation matrix look like? x’ = xT00 + yT10 + zT20 = S0x [ TS000 , T01, T02 [ [x, y, z] x = [x’, y’, z’] [ T010 , T11, T12 T020, T21, T22 !10 Scaling ‣ Changing from P [x, y, z] to P’ [S0·x, S1·y, S2·z] ‣ The “scaling factor”: [S0, S1, S2] ‣ How should the transformation matrix look like? x’ = xT00 + yT10 + zT20 = S0x [ TS000 , T001 , T02 [ [x, y, z] x = [x’, y’, z’] [ T010 , TS111 , T12 T020, T021, T22 !10 Scaling ‣ Changing from P [x, y, z] to P’ [S0·x, S1·y, S2·z] ‣ The “scaling factor”: [S0, S1, S2] ‣ How should the transformation matrix look like? x’ = xT00 + yT10 + zT20 = S0x [ TS000 , T001 , T002 [ [x, y, z] x = [x’, y’, z’] [ T010 , TS111 , T012 T020, T021, TS222 !10 Scaling ‣ Changing from P [x, y, z] to P’ [S0·x, S1·y, S2·z] ‣ The “scaling factor”: [S0, S1, S2] ‣ How should the transformation matrix look like? x’ = xT00 + yT10 + zT20 = S0x Scaling matrix is a [ [ diagonal matrix TS000 , T001 , T002 [x, y, z] x = [x’, y’, z’] [ T010 , TS111 , T012 T020, T021, TS222 !10 Scaling Even scaling 0.5, 0 x’ = 0.5x [x, y] x = [x’, y’] [ 0, 0.5 [ y’ = 0.5y Uneven scaling 0.5, 0 x’ = 0.5x [x, y] x = [x’, y’] [ 0, 1.5 [ y’ = 1.5y FCG 4e !11 Rotation ‣ What should the transformation matrix be to rotate P around the z-axis by �, regardless what P is? z y P [x, y, z] P’ [x’, y’, z] z Keep z the same, rotate within the x-y plane [x’, y’] y [x, y] � � x x Rotation !12 Rotation sin α = y / r cos α = x / r y [x’, y’] r [x, y] � α x Rotation !13 Rotation sin α = y / r cos α = x / r sin(α + �) = y’ / r = sin α * cos � + cos α * sin � y = y / r * cos � + x / r * sin � [x’, y’] r [x, y] � α x Rotation !13 Rotation sin α = y / r cos α = x / r sin(α + �) = y’ / r = sin α * cos � + cos α * sin � y = y / r * cos � + x / r * sin � y’ / r = y / r * cos � + x / r * sin � [x’, y’] r [x, y] � α x Rotation !13 Rotation sin α = y / r cos α = x / r sin(α + �) = y’ / r = sin α * cos � + cos α * sin � y = y / r * cos � + x / r * sin � y’ / r = y / r * cos � + x / r * sin � [x’, y’] y’ = y * cos � + x * sin � r [x, y] � α x Rotation !13 Rotation sin α = y / r cos α = x / r sin(α + �) = y’ / r = sin α * cos � + cos α * sin � y = y / r * cos � + x / r * sin � y’ / r = y / r * cos � + x / r * sin � [x’, y’] y’ = y * cos � + x * sin � r [x, y] � cos(α + �) = x’ / r = cos α * cos � - sin α * sin � α x = x / r * cos - y / r * sin Rotation � � !13 Rotation sin α = y / r cos α = x / r sin(α + �) = y’ / r = sin α * cos � + cos α * sin � y = y / r * cos � + x / r * sin � y’ / r = y / r * cos � + x / r * sin � [x’, y’] y’ = y * cos � + x * sin � r [x, y] � cos(α + �) = x’ / r = cos α * cos � - sin α * sin � α x = x / r * cos - y / r * sin Rotation � � x’ / r = x / r * cos � - y / r * sin � !13 Rotation sin α = y / r cos α = x / r sin(α + �) = y’ / r = sin α * cos � + cos α * sin � y = y / r * cos � + x / r * sin � y’ / r = y / r * cos � + x / r * sin � [x’, y’] y’ = y * cos � + x * sin � r [x, y] � cos(α + �) = x’ / r = cos α * cos � - sin α * sin � α x = x / r * cos - y / r * sin Rotation � � x’ / r = x / r * cos � - y / r * sin � x’ = x * cos � - y * sin � !13 Rotation Matrix (Around Z-axis) x’ = x cos � - y sin � y’ = x sin � + y cos � z’ = z T00, T01, T02 [ [x, y, z] x = [x’, y’, z’] [ T10, T11, T12 T20, T21, T22 !14 Rotation Matrix (Around Z-axis) x’ = x cos � - y sin � = xT00 + yT10 + zT20, for ∀ x, y, z y’ = x sin � + y cos � = xT01 + yT11 + zT21, for ∀ x, y, z z’ = z = xT02 + yT12 + zT22, for ∀ x, y, z T00, T01, T02 [ [x, y, z] x = [x’, y’, z’] [ T10, T11, T12 T20, T21, T22 !14 Rotation Matrix (Around Z-axis) x’ = x cos � - y sin � = xT00 + yT10 + zT20, for ∀ x, y, z y’ = x sin � + y cos � = xT01 + yT11 + zT21, for ∀ x, y, z z’ = z = xT02 + yT12 + zT22, for ∀ x, y, z cosT00 �, Tsin01 �, T020 [ [x, y, z] x -sinT10 �, Tcos11 �, T120 = [x’, y’, z’] [ 0 0 1 T20, T21, T22 !14 Rotation Matrix (Around Z-axis) x’ = x cos � - y sin � = xT00 + yT10 + zT20, for ∀ x, y, z y’ = x sin � + y cos � = xT01 + yT11 + zT21, for ∀ x, y, z z’ = z = xT02 + yT12 + zT22, for ∀ x, y, z cosT00 �, Tsin01 �, T020 [ [x, y, z] x -sinT10 �, Tcos11 �, T120 = [x’, y’, z’] [ 0 0 1 T20, T21, T22 z indeed doesn’t change! !14 Rotation Matrix [ 1 0 0 [ cos � 0 -sin � Around X 0 cos � sin � Around Y 0 1 0 [ 0 -sin � cos � [ sin � 0 cos � cos � sin � 0 [ Derive the rest in Around Z -sin � cos � 0 your homework. [ 0 0 1 !15 Fixed after lecture Orthogonal Matrix QT = Q-1 ‣ Rotation matrix is orthogonal matrix, whose Q QT = I transpose is the same as inversion. ▹ The length of each row is 1.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    103 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us