3D Transformations. Translation x’ = x + tx y’ = y + ty z’ = z + tz P = P’ = T = P’ = T. P 1 0 0 tx 0 1 0 ty 0 0 1 tz 0 0 0 1 xyz1xyz1 x’ y’ z’ 1 x y.

Slides:



Advertisements
Similar presentations
Computer Graphics - Transformation -
Advertisements

Computer Graphics 2D & 3D Transformation.
Hierarchical Transformation. Summary Alternatively, OpenGL thinks: A transformation updates the coordinate system. For each change, the transformation.
University of North Carolina at Greensboro
CS 4731: Computer Graphics Lecture 7: Introduction to Transforms, 2D transforms Emmanuel Agu.
Elementary 3D Transformations - a "Graphics Engine" Transformation procedures Transformations of coordinate systems Translation Scaling Rotation.
1 CSCE 441 Computer Graphics: 2D Transformations Jinxiang Chai.
2.1 si SI31 Advanced Computer Graphics AGR Lecture 2 Basic Modelling.
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.
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 Unit - 3. Why Transformations? In graphics, once we have an object described, transformations are used to move that object, scale it.
3D Transformation. In 3D, we have x, y, and z. We will continue use column vectors:. Homogenous systems:. 3D Transformation glVertex3f(x, y,z);
5.2 Three-Dimensional Geometric and Modeling Transformations 2D3D Consideration for the z coordinate.
Transformations Dr. Amy Zhang.
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.
Geometric Transformations Jehee Lee Seoul National University.
Part7: Geometric Transformations
 2D Transformations 2D Transformations  Translation Translation  Rotation Rotation  Scaling Scaling.
Geometry: 2-D Transformations Course web page: Chapter #3.
PPT&Programs&Labcourse 1.
1 Computer Graphics Week9 -3D Geometric Transformation.
2D Transformation. Transformation changes an object’s: – Position(Translation) – Size(Scaling) – Orientation(Rotation) – Shape(Deformation) Transformation.
Computer Graphics I, Fall 2010 OpenGL Transformations.
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
Geometric Transformations Sang Il Park Sejong University Many slides come from Jehee Lee’s.
January 19, y X Z Translations Objects are usually defined relative to their own coordinate system. We can translate points in space to new positions.
CS552: Computer Graphics Lecture 4: 2D Graphics. Recap 2D Graphics Coordinate systems 2D Transformations o Translation o Scaling o Rotation Combining.
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 By Dr. HANY ELSALAMONY.  We have seen how to create models in the 3D world. We discussed transforms in lecture 3, and we have used some transformations.
Homogeneous Coordinates and Matrix Representations Cartesian coordinate (x, y, z) Homogeneous coordinate (x h, y h, z h, h) Usually h = 1. But there are.
1 Geometric Transformations-II Modelling Transforms By Dr.Ureerat Suksawatchon.
Geometric Transformations. Transformations Linear transformations Rigid transformations Affine transformations Projective transformations T Global reference.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
1 Geometric Transformations Modelling Transforms By Dr.Ureerat Suksawatchon.
Transformations in 3D Lecture 17 Mon, Oct 6, 2003.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
CSCE 441 Computer Graphics: 2D Transformations
4. Geometric Objects and Transformations
Modeling Transformation
학기 Chapter 5. Geometric Transformations 1.
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.
OpenGL Transformations
2D Geometric Transformations
Computer Graphics 3D Transformations
OpenGL Transformations
Computer Graphics OpenGL Transformations
Three-Dimensional Graphics
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Geometric Transformations
Unit-5 Geometric Objects and Transformations-II
Geometric Transformations
Geometric Transformations
Transformations 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
The Modelview Matrix Lecture 8 Mon, Sep 10, 2007.
Three-Dimensional Graphics
Transformations in OpenGL
Geometric Objects and Transformations (II)
OpenGL Transformations
Geometric Transformations
TWO DIMENSIONAL TRANSFORMATION
Lecture #6 2D Geometric Transformations
OpenGL Transformations
Presentation transcript:

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 P P’ z

Scaling S = P’ = S. P wrt a fixed point (xf, yf, zf) : T(xf, yf, zf). S(sx, sy, sz). T(-xf, -yf, -zf) sx sy sz x y z

Rotation z-axis rotation x’ = x.cos  – y.sin  y’ = x.sin  y.cos  z’ = z R = P’ = R. P cos  -sin  sin  cos    x y z

Rotation x-axis rotation replace x -> y -> z -> x in z-axis rotation y’ = y.cos  – z.sin  z’ = y.sin  z.cos  x’ = x R = y-axis rotation replace x -> y -> z -> x in x-axis rotation z’ = z.cos  – x.sin  x’ = z.sin  x.cos  y’ = y R = cos  -sin  0 0 sin  cos  x y z cos  0 -sin  sin  0 cos  x y z z-axis rotation x’ = x.cos  – y.sin  y’ = x.sin  y.cos  z’ = z

Rotation Rotation about an arbitrary axis parallel to a coordinate axis P’ = T -1. Rx(  ). T. P x y z

Rotation x y z Rotation about an arbitrary axis NOT parallel to a coordinate axis

Rotation x y z Rotation about an arbitrary axis NOT parallel to a coordinate axis 1. Translate so that rotation axis passes through the origin

Rotation x y z Rotation about an arbitrary axis NOT parallel to a coordinate axis 1. Translate so that rotation axis passes through the origin 2. Rotate so that rotation axis coincides with a coordinate axis

Rotation x y z Rotation about an arbitrary axis NOT parallel to a coordinate axis 1. Translate so that rotation axis passes through the origin 2. Rotate so that rotation axis coincides with a coordinate axis 3. Rotate

Rotation x y z Rotation about an arbitrary axis NOT parallel to a coordinate axis 1. Translate so that rotation axis passes through the origin 2. Rotate so that rotation axis coincides with a coordinate axis 3. Rotate 4. Inverse rotation

Rotation x y z Rotation about an arbitrary axis NOT parallel to a coordinate axis 1. Translate so that rotation axis passes through the origin 2. Rotate so that rotation axis coincides with a coordinate axis 3. Rotate 4. Inverse rotation 5. Inverse translation

Reflection rotation about x-axis a combination of translation and rotation y x z x z y

Shear y x z y x z 1 0 shx –shx.zref 0 1 shy –shy.zref

OpenGL glTranslate*(tx, ty, tz) f (float) d (double) glRotate* (theta, vx, vy, vz) (vx, vy, vz) vector defines the orientation of the rotation axis that passes through the coordinate origin glScale*(sx, sy, sz)

OpenGL glMatrixMode(GL_MODELVIEW) sets up the matrix for transformations (4x4 modelview matrix) glLoadIdentity ( ) assigns identity matrix to the current matrix glLoadMatrix*(16-element array) assigns a 16-element array (in column major order) to the current matrix glMultMatrix*(16-element array) postmultiplies a 16-element array (M’) with the current matrix (M) : M <- M.M’

OpenGL glMatrixMode(GL_MODELVIEW); glLoadIdentity ( ); glMultMatrixf(M2); glMultMatrixf(M1); /* M = M2. M1 */

OpenGL Matrix Stack Initially stack contains identity matrix Maximum stack depth is 32 glGetIntegerv (GL_MAX_MODELVIEW_STACK_DEPTH, stacksize) returns the number of positions available in the modelview stack glGetIntegerv (GL_MODELVIEW_STACK_DEPTH, nummats) returns the number of matrices currently in the stack glPushMatrix() copies the current matrix at the top of the stack glPopMatrix() destroys the matrix at the top of the stack

OpenGL glMatrixMode(GL_MODELVIEW); glColor3f(0.0, 0.0, 1.0); Recti(50, 100, 200, 150); glColor3f(1.0, 0.0, 0.0); glTranslatef(-200.0, -50.0, 0.0); Recti(50, 100, 200, 150); glLoadIdentity ( ); glRotatef(90.0, 0.0, 0.0, 1.0); Recti(50, 100, 200, 150); glLoadIdentity ( ); glScalef(-0.5, 1.0, 1.0); Recti(50, 100, 200, 150);

OpenGL glMatrixMode(GL_MODELVIEW); glColor3f(0.0, 0.0, 1.0); Recti(50, 100, 200, 150); glPushMatrix(); glColor3f(1.0, 0.0, 0.0); glTranslatef(-200.0, -50.0, 0.0); Recti(50, 100, 200, 150); glPopMatrix(); glPushMatrix(); glRotatef(90.0, 0.0, 0.0, 1.0); Recti(50, 100, 200, 150); glPopMatrix(); glScalef(-0.5, 1.0, 1.0); Recti(50, 100, 200, 150);