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 ab cd ± · ° 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 20 03 ± · ° 1 1 ± = ° 2 3 ± ± · ° 3 3 ± = ° 6 9 ± ± · ° 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 10 0 . 51 ± displacement along direction proportional to (signed) distance to a line 01 ±

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 ) · 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) {
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 28

Lecture_Chapter4_b - Review of Thursday Vectors and points...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online