Week 03.pdf - COMP 6761\/2 Computer Graphics Week 3 3D Transformations Reading \u00a75-9 to 5-17 14-3 of H&B 3-D Transformations Overview \u2022 Types \u2013

Week 03.pdf - COMP 6761/2 Computer Graphics Week 3 3D...

This preview shows page 1 - 9 out of 33 pages.

8/6/2010 COMP 6761 Week 3 1 COMP 6761/2 Computer Graphics Week 3 3D Transformations Reading: § 5-9 to 5-17, 14-3 of H&B 3-D Transformations: Overview • Types – Translation – Rotation – Scaling Shear, reflection Mathematical representations OpenGL functions for applying transformations Uses of Transformations Modeling: position and resize parts of a complex model Viewing: define and position the virtual camera Animation: define how objects move/change with time
Image of page 1
8/6/2010 COMP 6761 Week 3 2 3D Transformations All transformations in 3D can be expressed as combinations of translations, rotations, scaling expressed using matrix multiplication • Translation P’ =T + P • Scale P’ =S P • Rotation P’ =R P We would like all transformations to be multiplications so we can concatenate them express points in homogenous coordinates. 3 COMP 6761 Week 3 Homogeneous coordinates Add an extra coordinate, W, to a point. P(x,y,z) barb2right P(xW,yW,zW,W) = P(x w ,y w ,z w ,W). Two sets of homogeneous coordinates represent the same point if they are a multiple of each other. – (2,5,3,11) and (4,10,6,22) represent the same point. At least one component must be non-zero (0,0,0,0) is not defined. If W 0 , divide by it to get Cartesian coordinates of point (x w /W,y w /W,z w /W,1). If W=0, point is said to be at infinity. 4 COMP 6761 Week 3
Image of page 2
8/6/2010 COMP 6761 Week 3 3 OpenGL’s coordinates The underlying form of all points/vertices is a 4-D vector (x h , y h , z h , w) If you do something in 2-D, OpenGL simply sets z = 0 for you If the scale coordinate w is not set explicitly (recall that there is a glVertex4() that allows you to do so), OpenGL sets w = 1 for you 5 COMP 6761 Week 3 3-D Translations 6 COMP 6761 Week 3
Image of page 3
8/6/2010 COMP 6761 Week 3 4 3D Translation = = 1 0 0 0 1 0 0 0 1 0 0 0 1 z y x translate T M T 7 COMP 6761 Week 3 3D Translation with homogeneous coordinates Old way: New way: 8 COMP 6761 Week 3
Image of page 4
8/6/2010 COMP 6761 Week 3 5 3-D Scaling 9 COMP 6761 Week 3 3-D Uniform Scaling Note that uniform scaling can also be accomplished using homogeneous coordinate properties by manipulating scale coordinate “Standard” scaling matrix 10 COMP 6761 Week 3
Image of page 5
8/6/2010 COMP 6761 Week 3 6 3-D Uniform Scaling Note that uniform scaling can also be accomplished using homogeneous coordinate properties by manipulating scale coordinate “Homogeneous” scaling matrix must normalize to 1 11 COMP 6761 Week 3 3-D Uniform Scaling Note that uniform scaling can also be accomplished using homogeneous coordinate properties by manipulating scale coordinate “Homogeneous” scaling matrix 12 COMP 6761 Week 3
Image of page 6
8/6/2010 COMP 6761 Week 3 7 3-D Rotations In 2-D, we are always rotating in the plane of the image, but in 3-D the axis of rotation itself is a variable Three canonical rotation axes are the coordinate axes X, Y, Z These are sometimes referred to in aviation terms: pitch , yaw or heading , and roll , respectively 13 COMP 6761 Week 3 Examples: 3-D Rotations The term “roll” is also sometimes used generically, as a synonym for “rotation” 14 COMP 6761 Week 3
Image of page 7
8/6/2010 COMP 6761 Week 3 8 3-D Rotation Matrices
Image of page 8
Image of page 9

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture