{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture_Chapter4_b

# Lecture_Chapter4_b - Review of Thursday Vectors and points...

This preview shows pages 1–9. Sign up to view the full content.

Review of Thursday Vectors and points are two/three-dimensional objects Operations on vectors (dot product, cross product, ) Matrices are linear transformations of vectors Objects are transformed by applying transformation matrix to its vertices (coordinate transformation) 29 ECS 175 Chapter 4: Object Transformation a b c d · x y = xa + yb xc + yd

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Review of Thursday Objects are transformed by applying transformation matrix to its vertices (coordinate transformation) 30 ECS 175 Chapter 4: Object Transformation anisotropic scaling 2 0 0 3 · 1 1 = 2 3 2 0 0 3 · 3 3 = 6 9 2 0 0 3 · 4 1 = 8 3 det ( M ) = 6
A Brief Review of Linear Algebra Rotation 31 ECS 175 Chapter 4: Object Transformation counterclockwise (positive direction of rotation) Determinant: cos α · cos α sin α · ( sin α ) = 1 cos α sin α sin α cos α Inverse M 1 = M T

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
A Brief Review of Linear Algebra Constructing a rotation matrix 32 ECS 175 Chapter 4: Object Transformation cos α sin α sin α cos α M (1 , 0) T = (cos α , sin α ) T M (0 , 1) T = ( sin α , cos α ) T ( a, b ) T = a (1 , 0) T + b (0 , 1) T M ( a, b ) T = aM (1 , 0) T + bM (0 , 1) T M ( a, b ) T = ( a cos α b sin α , a sin α + b cos α ) T columns correspond to axes of new coordinate frame (linearity of M)
A Brief Review of Linear Algebra Shear transformation (shearing) Reflection 33 ECS 175 Chapter 4: Object Transformation 1 0 0 . 5 1 displacement along direction proportional to (signed) distance to a line 1 0 0 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
A Brief Review of Linear Algebra Applying multiple transformations in sequence 34 ECS 175 Chapter 4: Object Transformation M scal · M rot · v = v ( M scal · M rot ) · v = v Order of operations is important!
Notes on Matrices in OpenGL 35 ECS 175 Chapter 4: Object Transformation OpenGL <3.0 includes matrix operations and stack Matrix operations and stack deprecated in OpenGL 3.0+ Implement own transformation matrices Pass to vertex shader (OpenGL/GLSL: uniform variables) glMatrixMode( ) glLoadMatrix( ) glMultMatrix( ) glPushMatrix() //push current matrix to top of stack glPopMatrix() //take matrix from top of stack Assignment 2: You may use glLoadMatrix, glMultMatrix or pass the matrices to the vertex shader as uniform variables (do not use glTranslate, glRotate).

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Notes on Matrices in OpenGL 36 ECS 175 Chapter 4: Object Transformation OpenGL <3.0 vertex shader example OpenGL 3.0+ vertex shader example void main(void) { gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex; } attribute vec3 in_Position;
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern