The Modelview Matrix Lecture 8 Mon, Sep 10, 2007.

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?
Geometric Transformations
CMPE 466 COMPUTER GRAPHICS
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations II Week.
1 Geometrical Transformation 2 Outline General Transform 3D Objects Quaternion & 3D Track Ball.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Transformations Objectives Understand how transformations work in 2D and 3D Understand the concept of homogenous coordinate system Understand scene graphs.
Objectives Learn to build arbitrary transformation matrices from simple transformations Learn to build arbitrary transformation matrices from simple transformations.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 OpenGL Transformations Ed Angel Professor of Computer Science, Electrical and Computer.
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
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.
3D Transformation. In 3D, we have x, y, and z. We will continue use column vectors:. Homogenous systems:. 3D Transformation glVertex3f(x, y,z);
TWO DIMENSIONAL GEOMETRIC TRANSFORMATIONS CA 302 Computer Graphics and Visual Programming Aydın Öztürk
Graphics Graphics Korea University kucg.korea.ac.kr Transformations 고려대학교 컴퓨터 그래픽스 연구실.
2D Transformations.
Lecture Notes: Computer Graphics.
2003CS Hons RW778 Graphics1 Chapter 5: Transforming Objects 5.2 Introduction to Transformations 5.2 Introduction to Transformations –Affine transformations.
Geometric transformations The Pipeline
Geometry: 2-D Transformations Course web page: Chapter #3.
Stages of Vertex Transformation To specify viewing, modeling, and projection transformations, you construct a 4 × 4 matrix M, which is then multiplied.
1 Computer Graphics Week9 -3D Geometric Transformation.
Computer Graphics I, Fall 2010 Computer Viewing.
Modeling with OpenGL Practice with OpenGL transformations.
2D Transformation. Transformation changes an object’s: – Position(Translation) – Size(Scaling) – Orientation(Rotation) – Shape(Deformation) Transformation.
Geometrical Transformations 2 Adapted from Fundamentals of Interactive Computer Graphics, Foley and van Dam, pp , by Geb Thomas.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 18 Multiple Transformations.
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.
3D Transformations. Translation x’ = x + tx y’ = y + ty z’ = z + tz P = P’ = T = P’ = T. P tx ty tz xyz1xyz1 x’ y’ z’ 1 x y.
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.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
Composing Transformations
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
1 OpenGL Transformations. 2 Objectives Learn how to carry out transformations in OpenGL ­Rotation ­Translation ­Scaling Introduce OpenGL matrix modes.
1 Geometric Transformations-II Modelling Transforms By Dr.Ureerat Suksawatchon.
1 Dr. Scott Schaefer 3D Transformations. 2/149 Review – Vector Operations Dot Product.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
CSCE 441: Computer Graphics: Hierarchical Models Jinxiang Chai.
CS380 LAB II OpenGL Donghyuk Kim Reference1. [OpenGL course slides by Rasmus Stenholt] Reference2. [
CSCE 441 Computer Graphics: 2D Transformations
Computer Graphics Lecture 42 Viewing Using OpenGL II Taqdees A. Siddiqi
FCC Graficación CAD/CAM 3D Transformations. Contents 1. Translation 2. Scaling 3. Rotation 4. Other Transformations.
The Modelview Stack Lecture 9 Wed, Sep 12, The Modelview Stack OpenGL maintains a stack of matrices. The matrix on top of the stack is the current.
Lecture 10 Geometric Transformations In 3D(Three- Dimensional)
Viewing.
Transformations Introduction to Computer Graphics and Animation
Computer Viewing.
2D Geometric Transformations
3D Geometric Transformations
Reference1. [OpenGL course slides by Rasmus Stenholt]
Transformation and Viewing
CSC461: Lecture 19 Computer Viewing
Geometric Transformations
Unit-5 Geometric Objects and Transformations-II
Chapter 4/5 glMatrixMode Modeling Transformations glTranslate glScale
Chapters 5/4 part2 understanding transformations working with matrices
Geometric Transformations
Three-Dimensional Graphics
Transformations in OpenGL
Geometric Transformations
Geometric Objects and Transformations (II)
Transformations III Week 3, Mon Jan 21
3D transformations Dr Nicolas Holzschuch University of Cape Town
Geometric Transformations
Translation in Homogeneous Coordinates
Presentation transcript:

The Modelview Matrix Lecture 8 Mon, Sep 10, 2007

Geometric Transformations and Matrices Each geometric transformation can be represented by a matrix. If a point P is represented by a vector p and a transformation is represented by a matrix M, then the product Mp represents the transformed point. That is, the transformed point P is represented by the vector p = Mp.

Sequences of Transformations Suppose that we perform two transformations in sequence. If M1 represents the first transformation and M2 represents the second transformation, then M2M1 represents the sequence of transformations. The same principle applies to any number of transformations in sequence.

The Modelview Matrix OpenGL maintains a matrix called the Modelview matrix. It records the current transformation, as determined by calls to glTranslatef(), glRotatef(), glScalef(), etc.. It should be initialized to the identity matrix.

The Modelview Matrix OpenGL code to initialize the Modelview matrix. glMatrixMode(GL_MODELVIEW); glLoadIdentity();

The Modelview Matrix If M is the current matrix or current transformation and we wish to apply transformation M1, then OpenGL computes MM1 and makes that the new current matrix. The old M is gone. Note that M was multiplied on the right by M1.

The Modelview Matrix Suppose the current transformation is M and we wish to apply a sequence of transformations M1, M2, and M3 to an object. We need to create MM3M2M1 on the stack. In other words, we call the various transformation functions in reverse order.

Example Suppose we begin with the unit sphere centered at the origin and we wish to Scale it by a factor of 2 in the y-direction, Rotate it 45 about the positive x-axis, Translate it +2 units in the z-direction.

Example OpenGL code for this sequence of transformations. glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0, 0.0, 2.0); glRotatef(45.0, 1.0, 0.0, 0.0); glScalef(1.0, 2.0, 1.0); glutSolidSphere(1.0, 40, 40);

Example OpenGL code for this sequence of transformations. glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0, 0.0, 2.0); glRotatef(45.0, 1.0, 0.0, 0.0); glScalef(1.0, 2.0, 1.0); glutSolidSphere(1.0, 40, 40); Apply transformations to the object in this order

Example Read Run

Combined Transformations Suppose we want to rotate an object about the point (x, y, z) (not the origin). We perform A translation by (-x, -y, -z). The rotation (about the origin). The inverse translation by (x, y, z). The first translation may not be necessary if we draw the object in object coordinates.

Rotation about an Arbitrary Axis Read Run