Chapters 5/4 part2 understanding transformations working with matrices

Slides:



Advertisements
Similar presentations
Computer Graphics 2D & 3D Transformation.
Advertisements

CLASS 4 CS770/870. Translation Scale Multiplying Matrices. The R C rule What happens when we do two translates? What happens when we do two scales?
CMPE 466 COMPUTER GRAPHICS
Objectives Learn to build arbitrary transformation matrices from simple transformations Learn to build arbitrary transformation matrices from simple transformations.
2IV60 Computer Graphics 2D transformations
2D Transformations x y x y x y. 2D Transformation Given a 2D object, transformation is to change the object’s Position (translation) Size (scaling) Orientation.
2D Transformations. World Coordinates Translate Rotate Scale Viewport Transforms Hierarchical Model Transforms Putting it all together.
1 Computer Graphics Week7 -2D Rotation. 3-Rotation A shape can be rotated about any of the three axes. A rotation about the z-axis will actually rotate.
3D Transformation. In 3D, we have x, y, and z. We will continue use column vectors:. Homogenous systems:. 3D Transformation glVertex3f(x, y,z);
1 Matrix Math ©Anthony Steed Overview n To revise Vectors Matrices n New stuff Homogenous co-ordinates 3D transformations as matrices.
2.2 Linear Transformations in Geometry For an animation of this topic visit
TWO DIMENSIONAL GEOMETRIC TRANSFORMATIONS CA 302 Computer Graphics and Visual Programming Aydın Öztürk
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Modeling with OpenGL Practice with OpenGL transformations.
WARM UP: Describe in words how to rotate a figure 90 degrees clockwise.
Computer Graphics I, Fall 2010 OpenGL Transformations.
2 COEN Computer Graphics I Evening’s Goals n Discuss viewing and modeling transformations n Describe matrix stacks and their uses n Show basic geometric.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 OpenGL Transformations.
Affine Transformation. Affine Transformations In this lecture, we will continue with the discussion of the remaining affine transformations and composite.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
©2005, Lee Iverson Lee Iverson UBC Dept. of ECE EECE 478 Viewing and Projection.
9-2 Reflections Objective: To find reflection images of figures.
Composing Transformations
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
Honors Geometry.  We learned how to set up a polygon / vertex matrix  We learned how to add matrices  We learned how to multiply matrices.
Transformation. 3D Transformation oIn the modeling lecture we saw how to define an object in terms of its vertices in object space oWe will now see how.
III- 1 III 3D Transformation Homogeneous Coordinates The three dimensional point (x, y, z) is represented by the homogeneous coordinate (x, y, z, 1) In.
1 Geometric Transformations-II Modelling Transforms By Dr.Ureerat Suksawatchon.
1 Geometric Transformations Modelling Transforms By Dr.Ureerat Suksawatchon.
In the last several lessons, you have described translations using coordinates. You have also developed strategies for determining where an object started.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
CS380 LAB II OpenGL Donghyuk Kim Reference1. [OpenGL course slides by Rasmus Stenholt] Reference2. [
CSCE 441 Computer Graphics: 2D Transformations
Transformations: Translations & Reflections
Transforms.
Transformations Introduction to Computer Graphics and Animation
OpenGL Transformations
Camera Position (5.6) we specify the position and orientation of the camera to determine what will be seen. use gluLookAt (eye x, y, z, at x, y, z, up.
2D Geometric Transformations
Computer Graphics CC416 Week 15 3D Graphics.
3B Reflections 9-2 in textbook
OpenGL Transformations
Computer Graphics OpenGL Transformations
Warm-Up NO NOTES! Despite the fact that you have not memorized the rules, determine what each of these transformations would do to an image. (reflect across.
Introduction to Computer Graphics CS 445 / 645
Reference1. [OpenGL course slides by Rasmus Stenholt]
Computer Graphics Transformations
Transformation and Viewing
© 2008, Fayyaz A. Afsar, DCIS, PIEAS.
Introduction to Computer Graphics with WebGL
COMP 175: Computer Graphics February 9, 2016
With an immediate use for it
Unit-5 Geometric Objects and Transformations-II
Chapter 4/5 glMatrixMode Modeling Transformations glTranslate glScale
Transformations 3 University of British Columbia
COMP 175: Computer Graphics February 21, 2016
4-4 Geometric Transformations with Matrices
Transformations 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
The Modelview Matrix Lecture 8 Mon, Sep 10, 2007.
Transformations in OpenGL
Rotation: all points in the original figure rotate, or turn, an identical number of degrees around a fixed point.
Geometric Objects and Transformations (II)
Transformation Operators
Properties or Rules of Transformations
Transformations.
OpenGL Transformations
Transformations with Matrices
Warm Up 6.3 Complete the chart for the given counterclockwise rotations about the origin. 90o 180o 270o R(3, -3) S(1, 4) Use.
Translation in Homogeneous Coordinates
Presentation transcript:

Chapters 5/4 part2 understanding transformations working with matrices composition of transformations homogeneous coordinates operations on points and vectors rotation, scaling, and translation as matrices

Multiplying matrices on the board 2d two 2x2 square matrices a 2x2 matrix times a vector figuring out matrices for rotation and scaling figure out matrix for translation

Multiplying matrices on the board 2d two 2x2 square matrices a 2x2 matrix times a vector figuring out matrices for rotation and scaling no 2x2 matrix for translation

Composition of transformations example: rotate 90 degrees, then 180 degrees follow a vector do the matrix multiplication

reflection Come up with a matrix for reflection across the y axis

reflection as scaling reflection across the y axis is scaling by -1 in x and 1 in y.

Rotation and reflection experiment work in pairs: On paper, draw axes and vector (2, 1)T Person 1, rotate 90 degrees, then reflect across y axis. Person 2, reflect across y axis, then rotate 90 degrees. Compare.

Figure out order of multiplication F is reFlection across y axis T is roTation of 90 degrees Person 1, compute FT, Person 2, compute TF Which one is rotation followed by reflection? (Apply to (2,1)T )

Figure out order of multiplication F is reFlection across y axis T is roTation of 90 degrees Person 1, compute FT, Person 2, compute TF Which one is rotation followed by reflection? (Apply to (2,1)T ) Answer: FT

3D 3x3 matrices 3 coordinates for vectors and points

homogeneous coordinates x y z 1 [ x y z 1]T = for a point. [ x y z 0]T = for a vector. x y z

operations on homogeneous coordinates You can add vectors: [ 2 3 4 0 ]T + [ 1 1 1 0]T = [ 3 4 5 0]T, a vector. You can NOT add points [ 2 3 4 1 ]T + [ 1 1 1 1]T = [ 3 4 5 2]T, not a point!

operations on homogeneous coordinates cont. You CAN add a vector to a point: [ 2 3 4 1 ]T + [ 1 1 1 0]T = [ 3 4 5 1]T, another point. p+v v p

rotation in homogeneous coordinates: Rotation about the z-axis: cos(θ) -sin(θ) 0 0 sin(θ) cos(θ) 0 0 0 0 1 0 0 0 0 1

scaling in homogeneous coordinates: Scaling 3 in x, 2 in y, 4 in z; 3 0 0 0 0 2 0 0 0 0 4 0 0 0 0 1

TRANSLATING in homogeneous coordinates: moving 3 in x, 2 in y, 4 in z directions; 1 0 0 3 a a+3 0 1 0 2 b = b+2 0 0 1 4 c c+4 0 0 0 1 1 1

PROJECTION and MODELVIEW Matrices GL_MODELVIEW is for organizing the pieces of the picture - building the model. GL_PROJECTION is for setting viewing box and type of projection for viewing.

PROJECTION and MODELVIEW Matrices Both matrices are alway active and being used. A point (vertex) is multiplied by the MODELVIEW matrix to place it in our scene then the result is multiplied by the PROJECTION matrix to project it to the front of the viewing box.

Composing Transformations run boxV5.cpp Key input t: glTranslatef(10.0,0.0,0.0); glRotatef(45.0, 0.0,0.0,1.0); glutWireCube(5.0); Key input r:

Why reversed? key input t: Model view matrix starts as I Call translate multiplies IT Call rotate multiplies ITR Draw cube multiplies ITRv for every point v of the cube. This applies R first, not T!

Book has lots of experiments with composition - run them with understanding!

boxV6.cpp original - a box and a sphere m: translate together o: say translate then rotate, but really rotate then translate Check out the code! try ortho and frustrum

PROJECTION and MODELVIEW Matrices We can only change or set one at a time. To modify one we have to put it in the "matrix modifying machine", eg glMatrixMode(GL_PROJECTION); glMatrixMode(GL_MODELVIEW);

PROJECTION and MODELVIEW Matrices To make sure we start with a clean slate: glLoadIdentity(); - this sets it to the identity matrix. Any new changes are made to the matrix that is currently "in Mode".

PROJECTION Matrix glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho... or glFrustum... This is usually in resize routine, but it can be modified in display routine. Remember to then return to the MODELVIEW matrix, glMatrixMode(GL_MODELVIEW);