DOC PREVIEW
CMU CS 15462 - lecture

This preview shows page 1-2-3-4-5-6 out of 18 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

15 462 Computer Graphics I Lecture 4 Transformations Vector Spaces Affine and Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices Angel Ch 4 January 23 2003 Frank Pfenning Carnegie Mellon University http www cs cmu edu fp courses graphics Geometric Objects and Operations Primitive types scalars vectors points Primitive operations dot product cross product Representations coordinate systems frames Implementations matrices homogeneous coor Transformations rotation scaling translation Composition of transformations OpenGL transformation matrices 01 23 2003 15 462 Graphics I 2 1 Scalars Scalars from scalar field Operations 0 1 1 Expected laws apply Examples rationals or reals with addition and multiplication 01 23 2003 15 462 Graphics I 3 Vectors Vectors u v w from vector space Includes scalar field Vector addition u v Zero vector 0 Scalar multiplication v 01 23 2003 15 462 Graphics I 4 2 Points Points P Q R from affine space Includes vector space Point point subtraction v P Q Define also P v Q 01 23 2003 15 462 Graphics I 5 Euclidean Space Assume vector space over real numbers Dot product u v 0 0 0 u v are orthogonal if u v 0 v 2 v v defines v the length of v Generally work in an affine Euclidean space 01 23 2003 15 462 Graphics I 6 3 Geometric Interpretations Lines and line segments Convexity Dot product and projections Cross product and normal vectors Planes 01 23 2003 15 462 Graphics I 7 Lines and Line Segments Parametric form of line P P0 d Line segment between Q and R P 1 Q R for 0 1 01 23 2003 15 462 Graphics I 8 4 Convex Hull Convex hull defined by P 1 P1 L n Pn for a1 L an 1 and 0 ai 1 i 1 n 01 23 2003 15 462 Graphics I 9 Projection Dot product projects one vector onto other u v u v cos 01 23 2003 15 462 Graphics I 10 5 Normal Vector Cross product defines normal vector u v n u v u v sin Right hand rule 01 23 2003 15 462 Graphics I 11 Plane Plane defined by point P0 and vectors u and v u and v cannot be parallel Parametric form T P0 u v Let n u v be the normal Then n P P0 0 iff P lies in plane 01 23 2003 15 462 Graphics I 12 6 Outline Vector Spaces Affine and Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices OpenGL Transformation Matrices 01 23 2003 15 462 Graphics I 13 Coordinate Systems Let v1 v2 v3 be three linearly independent vectors in a 3 dimensional vector space Can write any vector w as w 1 v1 2 v2 3 v3 for scalars 1 2 3 In matrix notation 01 23 2003 15 462 Graphics I 14 7 Frames Frame coordinate system origin P0 Any point P P0 1 v1 2 v2 3 v3 Useful in with homogenous coordinates 01 23 2003 15 462 Graphics I 15 Changes of Coordinate System Bases u1 u2 u3 and v1 v2 v3 Express basis vectors ui in terms of vj Represent in matrix form 01 23 2003 15 462 Graphics I 16 8 Map to Representations w 1 v1 2 v2 3 v3 aT 1 2 3 w 1 u1 2 u2 3 u3 bT 1 2 3 So a MT b and b MT 1 a Suffices for rotation and scaling not translation 01 23 2003 15 462 Graphics I 17 Outline Vector Spaces Affine and Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices OpenGL Transformation Matrices 01 23 2003 15 462 Graphics I 18 9 Linear Transformations 3 3 matrices represent linear transformations a Mb Can represent rotation scaling and reflection Cannot represent translation a and b represent vectors not points 01 23 2003 15 462 Graphics I 19 Homogeneous Coordinates In affine space P 1 v1 2 v2 3 v3 P0 Define 0 P 0 1 P P Then Point p 1 2 3 1 T Vector w 1 v1 2 v2 3 v3 Homogeneous coords a 1 2 3 0 T 01 23 2003 15 462 Graphics I 20 10 Translation of Frame Express frame u1 u2 u3 P0 in v1 v2 v3 Q0 Then 01 23 2003 15 462 Graphics I 21 Homogeneous Coordinates Summary Points 1 2 3 1 T Vectors 1 2 3 0 T Change of frame 01 23 2003 15 462 Graphics I 22 11 Outline Vector Spaces Affine and Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices OpenGL Transformation Matrices 01 23 2003 15 462 Graphics I 23 Affine Transformations Translation Rotation Scaling Any composition of the above Express in homogeneous coordinates Need 4 4 matrices Later projective transformations Also expressible as 4 4 matrices 01 23 2003 15 462 Graphics I 24 12 Translation p p d where d x y z 0 T p x y z 1 T p x y z 1 T x x x y y y z z z Express in matrix form p T p and solve for T 01 23 2003 15 462 Graphics I 25 Scaling x x x y y y z z z Express as p S p and solve for S 01 23 2003 15 462 Graphics I 26 13 Rotation in 2 Dimensions Rotation by about the origin x x cos y sin y x sin y cos Express in matrix form Note determinant is 1 01 23 2003 15 462 Graphics I 27 Rotation in 3 Dimensions Decompose into rotations about x y z axes 01 23 2003 15 462 Graphics I 28 14 Compose by Matrix Multiplication R Rz R y R x Applied from right to left R p Rz Ry Rx p Rz Ry Rx p Postmultiplication in OpenGL 01 23 2003 15 462 Graphics I 29 Rotation About a Fixed Point First translate to the origin Second rotate about the origin Third translate back To rotate by about z around pf M T pf Rz T pf 01 23 2003 15 462 Graphics I 30 15 Deriving Transformation Matrices Other examples see Angel Ch 4 8 See also Assignment 2 when it is out Hint manipulate matrices but remember geometric intuition 01 23 2003 15 462 Graphics I 31 Outline Vector Spaces Affine and Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices OpenGL Transformation Matrices 01 23 2003 15 462 Graphics I 32 16 Current Transformation Matrix Model view matrix usually affine Projection matrix usually not affine Manipulated separately glMatrixMode GL MODELVIEW glMatrixMode GL PROJECTION 01 23 2003 15 462 Graphics I 33 Manipulating the Current Matrix Load or postmultiply glLoadIdentity glLoadMatrixf m glMultMatrixf m Library functions to compute matrices glTranslatef dx dy dz glRotatef angle vx vy vz glScalef sx sy sz Recall last transformation is applied first 01 23 2003 15 462 Graphics I 34 17 Summary Vector Spaces Affine and Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices OpenGL Transformation Matrices 01 23 2003 15 462 Graphics I 35 OpenGL Tutors by Nate Robins Run under Windows Available at http www xmission com nate tutors html Example Transformation tutor 01 23 2003 15 462 Graphics I 36 18


View Full Document

CMU CS 15462 - lecture

Download lecture
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view lecture and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view lecture 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?