Download presentation

Presentation is loading. Please wait.

Published byKaylyn Douglas Modified over 2 years ago

1
CLASS 4 CS770/870

2
Translation

3
Scale

4
Multiplying Matrices. The R C rule What happens when we do two translates? What happens when we do two scales? What happens when we translate and scale, or scale then translate (Commutative?) Exercise

5
Matrices in GL virtual machine OpenGL maintains a matrix stack glPushMatrix() creates pushes a new 4x4 matrix on the top of the stack containing a copy of the existing top of stack matrix. glTranslate, glScale and glRotate cause a new matrix to be contructed and post multiplied by the top of the stack.

6
The matrix stack glLoadIdentity();M1 I glRotatef();M1 IR1 glTranslatef();M1 IR1T1 glScalef();M1 IR1T1S1 glPushMatrix();M2 M1 glTranslatef();M2 M1T2 glPushMatrix();M3 M2 M1 M2

7
The view window to viewport transformation In open GL As a set of matrixes

8
Rotation about z axis

9
Derive rotation about z Take notes Rotations about x and y.

10
Exercise: do it by drawing Given a square glRectf(-1,-1,1,1) glRotatef(-30.0,0,0,1); glScalef(2.0,1.0,1.0); gLTranslatef(2.0,0.0,0.0); glRectf (-1,-1,1,1); glTranslatef(0.0,2.0,0.0); glScalef(1.0,2.0,1.0); glRotatef(45,0.0,0.0, 1.0); glRectf (-1,-1,1,1);

11
The Scene window to viewport mapping Scene window box (Lsw, Rsw, Bsw, Tsw) Viewport box (Lvp, Rvp, Bvp, Tvp); Exercise specify open gl commands to accomplish this) If time construct the matrix (Just the top row)

12
Some basic linear algebra (CH 4) Dot and Cross Product. A dot product of unit vectors gives the cosine of the angle between two unit vectors a. b = (a 1 *b 1 + a 2 *b 2 + a 3 *b 3 ) = |a||b|cos( |a| = Sqrt(a 1 *a 1 + a 2 *a 2 + a 3 *a 3 ); a/|a| = a 1 /|a| + a 2/ |a| + a 3 /|a| // unit vector

13
Cross Product of two vectors a x b = (a 1, a 2, a 3 ) T x (b 1, b 2, b 3 ) The result is a vector = (a 2 * b 3 ) – (a 3 * b 2 ), (a 3 * b 1 ) – (a 1 * b 3 ), (a 1 * b 2 ) – (a 2 * b 1 ) If both vectors are unit vectors the result is at right angles to the plane running through the other two.

Similar presentations

Presentation is loading. Please wait....

OK

Day 4 Transformation and 2D

Day 4 Transformation and 2D

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on business plan of any product Download ppt on statistics for class 10th Parathyroid anatomy and physiology ppt on cells Ppt on next generation 2-stroke engine fuel Ppt on sports day activities Ppt on non ferrous minerals definition Ppt on summary writing worksheet Ppt on cartesian product of graphs Ppt on water conservation in hotels Ppt on number system class 10