Geometric Transformations

Slides:



Advertisements
Similar presentations
Today Composing transformations 3D Transformations
Advertisements

1Computer Graphics Homogeneous Coordinates & Transformations Lecture 11/12 John Shearer Culture Lab – space 2
Computer Graphics 2D & 3D Transformation.
Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutWireCube glutWireCone gluCylinder glutWireTeapot.
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?
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Transformations III Week.
2IV60 Computer Graphics 2D transformations
2D Transformations. World Coordinates Translate Rotate Scale Viewport Transforms Hierarchical Model Transforms Putting it all together.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
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.
Geometric transformations The Pipeline
 Transformations Describe the single transformation that will map triangle A onto each of the triangles B to J in turn.
Day 4 Transformation and 2D
Interactive Computer Graphics CS 418 – Spring 2015 Mesh Rendering, Transformation, Camera Viewing and Projection in OpenGL TA: Zhicheng Yan Sushma S Kini.
Introduction to OpenGL 1. 2 OpenGL A Graphics rendering API introduced in 1992 by Silicon Graphics Inc Provide the low-level functions to access graphics.
Open GL Lab 10 1 BSCS – 514 Computer Graphics Instructor Humera Tariq.
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.
Modeling with OpenGL Practice with OpenGL transformations.
Viewing CS418 Computer Graphics John C. Hart. Graphics Pipeline Homogeneous Divide Model Coords Model Xform World Coords Viewing Xform Still Clip Coords.
OpenGL: Modeling void DrawPyramid(){ glBegin(GL_TRIANGLES); glVertex3f(0.0, 0.0, 0.0); glVertex3f(0.0, 1.0, 0.0); glVertex3f(0.1, 0.0, 0.0); glVertex3f(0.0,
1/50 CS148: Introduction to Computer Graphics and Imaging Transforms CS148: Introduction to Computer Graphics and Imaging Transforms.
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.
Viewing and Transformation. Pixel pipeline Vertex pipeline Course Map Transformation & Lighting Primitive assembly Viewport culling & clipping Texture.
TRANSFORMATIONS SPI SPI TYPES OF TRANSFORMATIONS Reflections – The flip of a figure over a line to produce a mirror image. Reflections.
OpenGL: The Open Graphics Language Introduction By Ricardo Veguilla.
Rotation – A circular movement around a fixed point Rotation.
CS552: Computer Graphics Lecture 4: 2D Graphics. Recap 2D Graphics Coordinate systems 2D Transformations o Translation o Scaling o Rotation Combining.
Chap 3 Viewing and Transformation
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
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.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Transformation Example. Order of Transformation Matters Scale, translate Scale, translate Translate scale Translate scale Rotate, Translate Rotate, Translate.
CS380 LAB II OpenGL Donghyuk Kim Reference1. [OpenGL course slides by Rasmus Stenholt] Reference2. [
YEAR 11 MATHS REVISION Transformations.
Instructor: Dr. Shereen Aly Taie Basic Two-Dimensional Geometric Transformation 5.2 Matrix Representations and Homogeneous Coordinates 5.3 Inverse.
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.
Computer Graphics Lecture 34. OpenGL Programming II Taqdees A. Siddiqi
2D Geometric Transformations
3D Transformation.
11.4 Rotations 1/12/17.
Lecture 7 Geometric Transformations (Continued)
Reference1. [OpenGL course slides by Rasmus Stenholt]
Transformation and Viewing
Transformations Example Draw the line Draw 1 at , ,
Geometric Transformations
Unit-5 Geometric Objects and Transformations-II
Chapter 4/5 glMatrixMode Modeling Transformations glTranslate glScale
Transformations in 3 Dimensions CS /28/2018 Dr. Mark L. Hornick
A movement of a figure in a plane.
Transformations 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
The Modelview Matrix Lecture 8 Mon, Sep 10, 2007.
Transformations in OpenGL
Geometric Transformations
Geometric Objects and Transformations (II)
Transformation Operators
Transformations III Week 3, Mon Jan 21
Image manipulation via matrices
Transformations IV Week 3, Wed Jan 23
Geometric Transformations
Transformations Review
Lecture #6 2D Geometric Transformations
Translation in Homogeneous Coordinates
Presentation transcript:

Geometric Transformations Lab 7 Lab 6 Geometric Transformations Geometric Transformations

current matrix. That is, after  The glPushMatrix function pushes the current matrix stack down by one, duplicating the current matrix. That is, after a glPushMatrix call, the matrix on the top of the stack is identical to the one below it.  The glPopMatrixfunction pops the current matrix stack, replacing the current matrix with the one below it on the stack. Initially, each of the stacks contains one matrix, an identity matrix.

1. Translation 2. Rotation 3. Scaling

glTranslatef(Glfloat x , Glfloat y , Glfloat z); The glTranslate* function multiplies the current matrix by a translation matrix. float glTranslatef(Glfloat x , Glfloat y , Glfloat z); Double glTranslated(Gldouble x, Gldouble y, Gldouble z); Displacement on  X: x axis  Y: y axis  Z: z axis

The glRotated, glRotatef functions computes a matrix that performs a counterclockwise rotation of angle degrees about the vector from the origin through the point (x, y, z). Then multiplies the current matrix by a rotation matrix.

glRotatef(Glfloat angle,Glfloat x ,Glfloat y ,Glfloat z); Double glRotated(Glfloat angle,Gldouble x,Gldouble y,Gldouble z);  glRotatef(Ө, 0, 0, 0)  glRotatef(-Ө, 0, 0, 0)  Ө --> anticlockwise rotation  -Ө --> Clockwise rotation  0, 0 -> x,y -> Rotation about the origin

glColor3ub (37, 66, 101); glBegin(GL_TRIANGLES); glVertex2f(4,3); glVertex2f(8,12); glVertex2f(12,3); glEnd(); glRotatef(180,0,0,0); glColor3ub (112, 153,202); glBegin(GL_TRIANGLES); glVertex2f(4,3); glVertex2f(8,12); glVertex2f(12,3); glEnd();

glColor3ub (37, 66, 101); glBegin(GL_TRIANGLES); glVertex2f(4,3); glVertex2f(8,12); glVertex2f(12,3); glEnd(); glRotatef(180,1,0,0); glColor3ub (112, 153,202); glBegin(GL_TRIANGLES); glVertex2f(4,3); glVertex2f(8,12); glVertex2f(12,3); glEnd();

glColor3ub (37, 66, 101); glBegin(GL_TRIANGLES); glVertex2f(4,3); glVertex2f(8,12); glVertex2f(12,3); glEnd(); glRotatef(180,1,0,0); glColor3ub (112, 153,202); glBegin(GL_TRIANGLES); glVertex2f(4,3); glVertex2f(8,12); glVertex2f(12,3); glEnd();

Rotation around the point is not the origin point: Displacement the body until point rotation 1. match origin point. Rotate the body around the origin point 2. Inverse displacement for body (back the rotation point to its original position) 3. Rotation around the axis In the 3D When  glRotatef(180,1,0,0);X  glRotatef(180,0,1,0);Y  glRotatef(180,0,0,1);Z

Rotation around the axis In the third dimension: glPopMatrix(); glPushMatrix(); // y glPushMatrix(); glColor3ub (78, 110,20); glRotatef(180,0,1,0); glTranslatef(8,6,3); glutSolidTeapot(4.5); glPopMatrix(); // z glPushMatrix(); glColor3ub (128, 181,33); glRotatef(180,0,0,1); glTranslatef(8,6,3); glutSolidTeapot(4.5); glPopMatrix();

The glScaled and glScalef functions produces a general scaling matrix along the x, y, and z axes. The three arguments indicate the desired scale factors along each of the three axes. Then multiply the current matrix by a general scaling matrix.

Float glScalef(Glfloat x , Glfloat y , Glfloat z); Double glScaled(Gldouble x, Gldouble y, Gldouble z); x , y ,z >1  Enlarge the size x , y ,z > 0 and x , y ,z <1  Reduce the size x , y ,z < 0  Inverse

// blue TRIANGLES glColor3ub (33,88,104); glBegin(GL_TRIANGLES); glVertex3f(4,3,0); glVertex3f(6,6,0); glVertex3f(8,3,0); glEnd(); glPushMatrix(); // Light blue glScalef(2, 2.5, 2); glColor3ub (55,149,175); glBegin(GL_TRIANGLES); glVertex3f(4,3,0); glVertex3f(6,6,0); glVertex3f(8,3,0); glEnd(); glPopMatrix(); // red TRIANGLES glPushMatrix(); glScalef(0.5, 0.6, 0.5); glColor3ub (252,20,53); glBegin(GL_TRIANGLES); glVertex3f(4,3,0); glVertex3f(6,6,0); glVertex3f(8,3,0); glEnd(); glPopMatrix();

Scaling body for a fixed point in the second dimension : Displacement the body until fixed point match 1. origin point. Change the body size 2. Inverse displacement for body (back the fixed point to its original position) 3.

glPushMatrix(); glTranslatef(7.5,5.5,0); glScalef(2, 2, 2); glTranslatef(-7.5,-5.5,0); glColor3ub (255,130,45); glBegin(GL_TRIANGLES); glVertex3f(4,3,0); glVertex3f(7.5,10,0); glVertex3f(11,3,0); glEnd(); glPopMatrix(); glColor3ub (255,51,0); glBegin(GL_TRIANGLES); glVertex3f(4,3,0); glVertex3f(7.5,10,0);