Geometry: 2-D Transformations Course web page: Chapter #3.

Slides:



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

Transformations Ed Angel Professor Emeritus of Computer Science
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?
Geometric Transformations
CMPE 466 COMPUTER GRAPHICS
Transformations II Week 2, Wed Jan 17
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations II Week.
2-D Geometry. The Image Formation Pipeline Outline Vector, matrix basics 2-D point transformations Translation, scaling, rotation, shear Homogeneous.
CS 4731: Computer Graphics Lecture 7: Introduction to Transforms, 2D transforms Emmanuel Agu.
Computer Vision : CISC4/689
1 Geometrical Transformation Tong-Yee Lee. 2 Modeling Transform Specify transformation for objects Allow definitions of objects in own coordinate systems.
Course Website: Computer Graphics 3: 2D Transformations.
The Image Formation Pipeline
Computer Graphics University of Palestine Dr. Sana’a Wafa Al-Sayegh
OpenGL (II). How to Draw a 3-D object on Screen?
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
10/5/04© University of Wisconsin, CS559 Fall 2004 Last Time Compositing Painterly Rendering Intro to 3D Graphics Homework 3 due Oct 12 in class.
UNIT - 5 3D transformation and viewing. 3D Point  We will consider points as column vectors. Thus, a typical point with coordinates (x, y, z) is represented.
3D Transformation. In 3D, we have x, y, and z. We will continue use column vectors:. Homogenous systems:. 3D Transformation glVertex3f(x, y,z);
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Transformations Dr. Amy Zhang.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
Graphics Graphics Korea University kucg.korea.ac.kr Transformations 고려대학교 컴퓨터 그래픽스 연구실.
2D Transformations.
2D Geometric Transformations
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
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.
Affine Transformation. Affine Transformations In this lecture, we will continue with the discussion of the remaining affine transformations and composite.
University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Hierarchical Modeling.
Lecture 5: Introduction to 3D
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.
Honors Geometry.  We learned how to set up a polygon / vertex matrix  We learned how to add matrices  We learned how to multiply matrices.
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.
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.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Computer Graphics I, Fall 2010 Transformations.
1 Geometric Transformations Modelling Transforms By Dr.Ureerat Suksawatchon.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
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.
CSCE 441 Computer Graphics: 2D 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.
Transformations University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner.
Transforms.
2D Geometric Transformations
Chapter 5 2-D Transformations.
Computer Graphics Transformations.
Geometric Transformations
Unit-5 Geometric Objects and Transformations-II
2-D Geometry.
Chapter 4/5 glMatrixMode Modeling Transformations glTranslate glScale
Chapters 5/4 part2 understanding transformations working with matrices
Geometric Transformations
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.
Geometric Transformations
Hierarchical Modeling
Presentation transcript:

Geometry: 2-D Transformations Course web page: Chapter #3

Why We Need Transformations What can we do so far? –Draw 2-D shapes by exhaustively listing their vertices –Allow user interaction Something missing: –The ability to specify the intrinsic shape of an object independently of its location, scale, or orientation

Example: Shape vs. Viewing Issues

Transformations for modeling, viewing 1.Make object model in idealized coordinate frame 2.Transform object with appropriate translation, scaling, rotation as needed Also useful for building complex objects from simpler parts from Hill

Notes on Notation Vectors, points: x, v (assume column vectors) Matrices: R, T Scalars: x, a Axes, objects: X, Y, O Coordinate systems: W, C Specials –Transpose operator: x T (as opposed to x 0 ) –Identity matrix: Id –Matrices/vectors of zeroes, ones: 0, 1

2-D Transformations Types –Translation –Scaling –Rotation –Shear, reflection Mathematical representation OpenGL functions for applying

2-D Translation

2-D Scaling

1 sxsx Horizontal shift proportional to horizontal position

2-D Scaling 1 sysy Vertical shift proportional to vertical position

2-D Scaling

2-D Rotation

This is a counterclockwise rotation

2-D Rotation µ This is a counterclockwise rotation

2-D Rotation

2-D Rotation (uncentered)

2-D Shear (horizontal)

Horizontal displacement proportional to vertical position

2-D Shear (horizontal)

2-D Reflection (vertical)

Just a special case of scaling—”negative” scaling

2-D Reflection (vertical)

2-D Transformations: OpenGL 2-D transformation functions * –glTranslate(x, y, 0) –glScale(sx, sy, 0) –glRotate(theta, 0, 0, 1) (angle in degrees; direction is counterclockwise) Notes –Set glMatrixMode(GL_MODELVIEW) first –Transformations should be specified before drawing commands to be affected –Multiple transformations are applied in reverse order * Technically, these are 3-D

Example: 2-D Translation in OpenGL Two ways to do this: glRectf(.25,.25,.75,.75);glTranslatef(.5,.5,0); glRectf(-.25,-.25,.25,.25);

Example: Order of transformations glTranslatef(.5,.5,0); glRotatef(45,0,0,1); glRectf(-.25,-.25,.25,.25); glRotatef(45,0,0,1); glTranslatef(.5,.5,0); glRectf(-.25,-.25,.25,.25); Remember: Order of application is backwards from drawing commands

Limiting “Scope” of Transformations Transformations are ordinarily applied to all subsequent draw commands To limit effects, use push/pop functions: glPushMatrix(); // transform // draw affected by transform glPopMatrix(); // draw unaffected by transform

Example: Pushing, popping transformations glPushMatrix(); glTranslatef(.5,.5,0); glRotatef(45,0,0,1); glRectf(-.25,-.25,.25,.25); glPopMatrix(); glPushMatrix(); // draw axis lines glPopMatrix();