CSC 470 Computer Graphics
|
|
- Gwendolyn Williamson
- 5 years ago
- Views:
Transcription
1 CSC 470 Computer Graphics Transformations of Objects CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 1
2 Transformations of objects - 2D CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 2
3 Using Transformations The arch is designed in its own coordinate system. The scene is drawn by placing a number of instances of the arch at different places and with different sizes. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 3
4 Using Transformations cont d In 3D, many cubes make a city. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 4
5 Using Transformations cont d A designer may want to view an object from different vantage points. Positioning and reorienting a camera can be carried out through the use of 3D affine transformations. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 5
6 Using Transformations cont d In a computer animation, objects move. We make them move by translating and rotating their local coordinate systems as the animation proceeds. A number of graphics platforms, including OpenGL, provide a graphics pipeline: a sequence of operations which are applied to all points that are sent through it. A drawing is produced by processing each point. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 6
7 The OpenGL Graphics Pipeline This version is simplified. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 7
8 Graphics Pipeline (2) An application sends the pipeline a sequence of points P 1, P 2,... using commands such as: glbegin(gl_lines); glvertex3f(...); // send P1 through the pipeline glvertex3f(...); // send P2 through the pipeline... glend(); These points first encounter a transformation called the current transformation (CT), which alters their values into a different set of points, say Q 1, Q 2, Q 3. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 8
9 Object transformations vs coordinate transformations There are two ways to view a transformation: as an object transformation or as a coordinate transformation. An object transformation alters the coordinates of each point on the object according to some rule, leaving the underlying coordinate system fixed. A coordinate transformation defines a new coordinate system in terms of the old one, then represents all of the object s points in this new system. The two views are closely connected, and each has its advantages, but they are implemented somewhat differently. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 9
10 Affine transformations have a simple form: the coordinates of Q are linear combinations of those of P for some six given constants m11, m12, etc. Q x consists of portions of both of P x and Py, and so does Qy. This cross fertilization between the x- and y- components gives rise to rotations and shears. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 10
11 CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 11 Affine Transformations - Vectors When vector V is transformed by the same affine transformation as point P, the result is Important: to transform a point P into a point Q, post-multiply M by P: Q = M P. = y x y x V V m m m m m m W W
12 Geometric Effects of Affine Transformations Combinations of four elementary transformations: (a) a translation, (b) a scaling, (c) a rotation, and (d) a shear (all shown below). CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 12
13 Affine transformations - translation CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 13
14 Affine transformations - scaling Reflection Sx=3; Sy=-2 CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 14
15 Example of Scaling The scaling (Sx, Sy) = (-1, 2) is applied to a collection of points. Each point is both reflected about the y-axis and scaled by 2 in the y-direction. y x CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 15
16 Types of Scaling Pure reflections, for which each of the scale factors is +1 or -1. A uniform scaling, or a magnification about the origin: S x = S y, magnification S. Reflection also occurs if S x or S y is negative. If S < 1, the points will be moved closer to the origin, producing a reduced image. If the scale factors are not the same, the scaling is called a differential scaling. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 16
17 Affine transformations - rotation CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 17
18 Affine transformations - shearing CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 18
19 CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 19 Inverse Translation and Scaling Inverse of translation T -1 : Inverse of scaling S -1 : = P P t t Q Q y x y x y x = / / 1 P P S S Q Q y x y x y x Formulas:
20 CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 20 Inverse Rotation and Shear Inverse Rotation and Shear Inverse of rotation R -1 = R(-θ): Inverse of shear H -1 : generally h=0 or g=0. ( ) ( ) ( ) ( ) = cos sin 0 sin cos 1 P P Q Q y x y x θ θ θ θ gh P P g h Q Q y x y x =
21 Affine transformations - concatenation A point P is first transformed by M1P and then by M2(M1P). Therefore the composition matrix is M=M2M1. Rotating About an Arbitrary Point CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 21
22 Composing Affine Transformations: Examples To rotate around an arbitrary point: translate P to the origin, rotate, translate P back to original position. Q = T P R T -P P Shear around an arbitrary point: Q = T P H T -P P Scale about an arbitrary point: Q = T P ST -P P CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 22
23 Affine transformations - concatenation Reflection about a tilted line cos(β) sin(β) CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 23
24 Affine transformations - properties Affine transformations preserve affine combinations of points. Affine transformations preserve lines and planes. Parallelism of lines and planes is preserved. The Columns of the Matrix reveal the Transformed Coordinate Frame. Relative Ratios Are Preserved. Effect of Transformations on the Areas of Figures. Every Affine Transformation is Composed of Elementary Operations. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 24
25 Affine transformations - 3D Colored cube CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 25
26 Affine transformations - 3D - basic CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 26
27 Affine transformations - 3D - rotation CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 27
28 Rotations Rotations are more complicated. We start by defining a roll (rotation counter-clockwise around an axis looking toward the origin): CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 28
29 Example A barn in its original orientation, and after a -70 x-roll, a 30 y-roll, and a -90 z-roll. a). the barn b) x-roll c) y-roll d) z-roll CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 29
30 Affine transformations - using OpenGL CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 30
31 Example When glvertex2d()is called with argument V, the vertex V is first transformed by the CT to form point Q. Q is then passed through the window to viewport mapping to form point S in the screen window. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 31
32 Example cont d The principal routines for altering the modelview matrix are glrotated(), glscaled(), and gltranslated(). These don t set the CT directly; instead each one postmultiplies the CT (the modelview matrix) by a particular matrix, say M, and puts the result back into the CT. That is, each of these routines creates a matrix M as required for the new transformation, and performs: CT = CT *M. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 32
33 Example cont d Of course, we have to start with some MODELVIEW matrix: The sequence of commands is glmatrixmode (GL_MODELVIEW); glloadidentity(); // transformations 1, 2, 3,... (in reverse order) CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 33
34 Example cont d Code to draw house #2: note translate is done before rotate (reverse order). setwindow(...); setviewport(..); // set window to viewport // mapping initct(); // get started with identity // transformation translate2d(32, 25); // CT includes translation rotate2d(-30.0); // CT includes translation and // rotation house(); // draw the transformed house CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 34
35 Example 2: Star A star made of interlocking stripes: starmotif() draws a part of the star, the polygon shown in part b. (Help on finding polygon s vertices in Case Study 5.1.) To draw the whole star we draw the motif five times, each time rotating the motif through an additional 72. a). b). (x1,y1) CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 35
36 Example: Dino Patterns The dinosaurs are distributed around a circle in both versions. Left: each dinosaur is rotated so that its feet point toward the origin; right: all the dinosaurs are upright. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 36
37 Example dino drawdino() draws an upright dinosaur centered at the origin. In a) the coordinate system for each motif is rotated about the origin through a suitable angle, and then translated along its y-axis by H units. Note that the CT is reinitialized each time through the loop so that the transformations don t accumulate. An easy way to keep the motifs upright (as in part b) is to pre-rotate each motif before translating it. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 37
38 CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 38
39 Summary of the OpenGL Transforms Projection Clips and sizes the viewing volume Viewing Specifies the location of the viewer or camera Modeling Moving the model around the scene Modelview Describes the quality of viewing and modeling transformations Viewport Scales the final output to the window CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 39
40 Objectives Learn how to carry out transformations in OpenGL Rotation Translation Scaling Introduce OpenGL matrix modes Model-view Projection CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 40
41 OpenGL Matrices In OpenGL matrices are part of the state Three types Model-View (GL_MODELVIEW) Projection (GL_PROJECTION) Texture (GL_TEXTURE) (ignore for now) Single set of functions for manipulation Select which to manipulated by glmatrixmode(gl_modelview); glmatrixmode(gl_projection); CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 41
42 Current Transformation Matrix (CTM) Conceptually there is a 4 x 4 homogeneous coordinate matrix, the current transformation matrix (CTM) that is part of the state and is applied to all vertices that pass down the pipeline The CTM is defined in the user program and loaded into a transformation unit vertices p C CTM p =Cp vertices CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 42
43 CTM operations The CTM can be altered either by loading a new CTM or by postmutiplication Load an identity matrix: C I Load an arbitrary matrix: C M Load a translation matrix: C T Load a rotation matrix: C R Load a scaling matrix: C S Postmultiply by an arbitrary matrix: C CM Postmultiply by a translation matrix: C CT Postmultiply by a rotation matrix: C CR Postmultiply by a scaling matrix: C CS CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 43
44 Rotation about a Fixed Point Start with identity matrix: C I Move fixed point to origin: C CT -1 Rotate: C CR Move fixed point back: C CT Result: C = T -1 RT Each operation corresponds to one function call in the program. Note that the last operation specified is the first executed in the program CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 44
45 CTM in OpenGL OpenGL has a model-view and a projection matrix in the pipeline which are concatenated together to form the CTM Can manipulate each by first setting the matrix mode CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 45
46 Rotation, Translation, Scaling Load an identity matrix: glloadidentity() Multiply on right: glrotatef(theta, vx, vy, vz) theta in degrees, (vx, vy, vz) define axis of rotation gltranslatef(dx, dy, dz) glscalef( sx, sy, sz) Each has a float (f) and double (d) format (glscaled) CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 46
47 Example Rotation about z axis by 30 degrees with a fixed point of (1.0, 2.0, 3.0) glmatrixmode(gl_modelview); glloadidentity(); gltranslatef(1.0, 2.0, 3.0); glrotatef(30.0, 0.0, 0.0,.10); gltranslatef(-1.0, -2.0, -3.0); Remember that last matrix specified in the program is the first applied CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 47
48 How OpenGL operates OpenGL is organized to postmultiply each new transformation matrix to combine it with the current transformation. Thus it will often seem more natural to the modeler to think in terms of successively transforming the coordinate system involved, as the order in which these transformations is carried out is the same as the order in which OpenGL computes them. OpenGL maintains a so-called modelview matrix, and every vertex that is passed down the graphics pipeline is multiplied by it. We need only set up the modelview matrix to embody the desired transformation. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 48
49 The principal routines for altering the modelview matrix are glrotated(), glscaled(), and gltranslated(). These don t set the CT directly; instead each postmultiplies the CT (the modelview matrix) by a particular matrix, say M, and puts the result back into the CT. That is, each of these routines creates a matrix M as required for the new transformation, and performs: The order is important. As we saw earlier, applying CT * M to a point is equivalent to first performing the transformation embodied in M, followed by performing the transformation dictated by the previous value of CT. Or if we are thinking in terms of transforming the coordinate system, it is equivalent to performing one additional transformation to the existing current coordinate system. Since these routines only compose a transformation with the CT, we need some way to get started: to initialize the CT to the identity transformation. OpenGL provides glloadidentity(). And because these functions can be set to work on any of the matrices that OpenGL supports, we must inform OpenGL which matrix we are altering. This is accomplished using glmatrixmode(gl_modelview). CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 49
50 Stack of transformations The top matrix on the stack is the actual CT, and operations like rotate2d() compose their transformation with it. To save this CT for later use a copy of it is made and pushed onto the stack using a routine pushct(). This makes the top two items on the stack identical. The top item can now be altered further with additional calls to scale2d() and the like. To return to the previous CT the top item is simply popped off the stack using popct(), and discarded. CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 50
51 Order of Transformations in OpenGL The current transform matrix (CTM) is the cumulative state of transformations that have been specified before a vertex is defined. In OpenGL, a list of transformations is postmultiplied to the CTM. This means that the transformation specified most recently is the one applied first. Picture this a stack of transformations... CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 51
52 Order of Transformations in OpenGL (cont.) If we specify a list of transformations, and then define vertices - all the the transformations specified will be applied to those vertices according to the postmultiplication rule. If we subsequently want to draw vertices without any transformations we can: Keep a copy of the transformations that have been applied to the CTM, and negate them by applying their opposites to the CTM in the correct order. or Save the untransformed CTM using glpushmatrix() perform our transforming/vertex drawing, then recall the original CTM with glpopmatrix(). CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 52
53 Saving the CT for Later Use Ex.: Tilings made easy cvs.pushct(); // so we can return here cvs.translate2d(w, H); // position for the first motif for(row = 0; row < 3; row++) // draw each row { cvs.pushct(); // draw the next row for(col = 0; col < 4; col++) { motif(); // move to the right cvs.translate2d(l, 0); } cvs.popct(); // back to the start of this row // move up to the next row cvs.translate2d(0, D); } cvs.popct(); // back to where we started CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 53
54 Order of Transformations in OpenGL (cont.) glpushmatrix(); apply scaling drawcube(); glpushmatrix(); apply translation... drawcube(); glpopmatrix(); apply scaling drawcube(); saves the original CTM applies a scaling to the CTM saves the CTM with scaling restores the CTM that was pushed last glpopmatrix(); drawcube(); restores the original CTM CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 54
55 Using Transformations Example: use idle function to rotate a cube and mouse function to change direction of rotation Start with a program that draws a cube (colorcube.c) in a standard way Centered at origin Sides aligned with axes Will discuss modeling in next lecture CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 55
56 main.c void main(int argc, char **argv) { glutinit(&argc, argv); glutinitdisplaymode(glut_double GLUT_RGB GLUT_DEPTH); glutinitwindowsize(500, 500); glutcreatewindow("colorcube"); glutreshapefunc(myreshape); glutdisplayfunc(display); glutidlefunc(spincube); glutmousefunc(mouse); glenable(gl_depth_test); glutmainloop(); } CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 56
57 Idle and Mouse callbacks void spincube() { theta[axis] += 2.0; if( theta[axis] > ) theta[axis] -= 360.0; glutpostredisplay(); } void mouse(int btn, int state, int x, int y) { if(btn==glut_left_button && state == GLUT_DOWN) axis = 0; if(btn==glut_middle_button && state == GLUT_DOWN) axis = 1; if(btn==glut_right_button && state == GLUT_DOWN) axis = 2; } CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 57
58 Display callback void display() { glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); glloadidentity(); glrotatef(theta[0], 1.0, 0.0, 0.0); glrotatef(theta[1], 0.0, 1.0, 0.0); glrotatef(theta[2], 0.0, 0.0, 1.0); colorcube(); glutswapbuffers(); } Note that because of fixed from of callbacks, variables such as theta and axis must be defined as globals Camera information is in standard reshape callback CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 58
Order of Transformations
Order of Transformations Because the same transformation is applied to many vertices, the cost of forming a matrix M=ABCD is not significant compared to the cost of computing Mp for many vertices p Note
More informationComputer Graphics CS 543 Lecture 5 (Part 2) Implementing Transformations
Computer Graphics CS 543 Lecture 5 (Part 2) Implementing Transformations Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Objectives Learn how to implement transformations
More informationModeling Transform. Chapter 4 Geometric Transformations. Overview. Instancing. Specify transformation for objects 李同益
Modeling Transform Chapter 4 Geometric Transformations 李同益 Specify transformation for objects Allow definitions of objects in own coordinate systems Allow use of object definition multiple times in a scene
More informationComputer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)
Computer Graphics (CS 47) Lecture : Implementing Transformations Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Objectives Learn how to implement transformations in OpenGL
More informationCS D Transformation. Junqiao Zhao 赵君峤
CS10101001 3D Transformation Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Review Translation Linear transformation
More informationComputer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)
Computer Graphics (CS 47) Lecture : Implementing Transformations Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Objectives Learn how to implement transformations in OpenGL
More informationCS 4204 Computer Graphics
CS 424 Computer Graphics 2D Transformations Yong Cao Virginia Tech References: Introduction to Computer Graphics course notes by Doug Bowman Interactive Computer Graphics, Fourth Edition, Ed Angle Transformations
More informationTransformations. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science
Transformations CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce standard transformations - Rotation - Translation - Scaling - Shear Derive
More informationObjectives. transformation. General Transformations. Affine Transformations. Notation. Pipeline Implementation. Introduce standard transformations
Objectives Transformations CS Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Introduce standard transformations - Rotation - Translation - Scaling - Shear Derive homogeneous
More informationIntroduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico WebGL Transformations
More informationComputer Graphics. Chapter 7 2D Geometric Transformations
Computer Graphics Chapter 7 2D Geometric Transformations Chapter 7 Two-Dimensional Geometric Transformations Part III. OpenGL Functions for Two-Dimensional Geometric Transformations OpenGL Geometric Transformation
More informationModeling Objects by Polygonal Approximations. Linear and Affine Transformations (Maps)
Modeling Objects by Polygonal Approximations Define volumetric objects in terms of surfaces patches that surround the volume Each surface patch is approximated set of polygons Each polygon is specified
More informationLecture 4: Transformations and Matrices. CSE Computer Graphics (Fall 2010)
Lecture 4: Transformations and Matrices CSE 40166 Computer Graphics (Fall 2010) Overall Objective Define object in object frame Move object to world/scene frame Bring object into camera/eye frame Instancing!
More informationC OMPUTER G RAPHICS Thursday
C OMPUTER G RAPHICS 2017.04.27 Thursday Professor s original PPT http://calab.hanyang.ac.kr/ Courses Computer Graphics practice3.pdf TA s current PPT not uploaded yet GRAPHICS PIPELINE What is Graphics
More informationComputer graphics MN1
Computer graphics MN1 Hierarchical modeling Transformations in OpenGL glmatrixmode(gl_modelview); glloadidentity(); // identity matrix gltranslatef(4.0, 5.0, 6.0); glrotatef(45.0, 1.0, 2.0, 3.0); gltranslatef(-4.0,
More informationHierarchical Modeling: Tree of Transformations, Display Lists and Functions, Matrix and Attribute Stacks,
Hierarchical Modeling: Tree of Transformations, Display Lists and Functions, Matrix and Attribute Stacks, Hierarchical Modeling Hofstra University 1 Modeling complex objects/motion Decompose object hierarchically
More informationComputer Graphics Geometric Transformations
Computer Graphics 2016 6. Geometric Transformations Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2016-10-31 Contents Transformations Homogeneous Co-ordinates Matrix Representations of Transformations
More informationCS452/552; EE465/505. Transformations
CS452/552; EE465/55 Transformations 1-29-15 Outline! Transformations Read: Angel, Chapter 4 (study cube.html/cube.js example) Helpful links: Linear Algebra: Khan Academy Lab1 is posted on github, due:
More informationFall CSCI 420: Computer Graphics. 2.2 Transformations. Hao Li.
Fall 2017 CSCI 420: Computer Graphics 2.2 Transformations Hao Li http://cs420.hao-li.com 1 OpenGL Transformations Matrices Model-view matrix (4x4 matrix) Projection matrix (4x4 matrix) vertices in 3D Model-view
More informationInteraction. CSCI 480 Computer Graphics Lecture 3
CSCI 480 Computer Graphics Lecture 3 Interaction January 18, 2012 Jernej Barbic University of Southern California Client/Server Model Callbacks Double Buffering Hidden Surface Removal Simple Transformations
More informationInteraction Computer Graphics I Lecture 3
15-462 Computer Graphics I Lecture 3 Interaction Client/Server Model Callbacks Double Buffering Hidden Surface Removal Simple Transformations January 21, 2003 [Angel Ch. 3] Frank Pfenning Carnegie Mellon
More informationCS380: Computer Graphics 2D Imaging and Transformation. Sung-Eui Yoon ( 윤성의 ) Course URL:
CS380: Computer Graphics 2D Imaging and Transformation Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/cg Class Objectives Write down simple 2D transformation matrixes Understand the
More informationTransformations. CSCI 420 Computer Graphics Lecture 4
CSCI 420 Computer Graphics Lecture 4 Transformations Jernej Barbic University of Southern California Vector Spaces Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices [Angel, Ch. 4]
More informationLecture 6 Sections 4.3, 4.6, 4.7. Wed, Sep 9, 2009
Lecture 6 Sections 4.3, 4.6, 4.7 Hampden-Sydney College Wed, Sep 9, 2009 Outline 1 2 3 4 re are three mutually orthogonal axes: the x-axis, the y-axis, and the z-axis. In the standard viewing position,
More informationLecture 5: Viewing. CSE Computer Graphics (Fall 2010)
Lecture 5: Viewing CSE 40166 Computer Graphics (Fall 2010) Review: from 3D world to 2D pixels 1. Transformations are represented by matrix multiplication. o Modeling o Viewing o Projection 2. Clipping
More informationAffine Transformations in 3D
Affine Transformations in 3D 1 Affine Transformations in 3D 1 Affine Transformations in 3D General form 2 Translation Elementary 3D Affine Transformations 3 Scaling Around the Origin 4 Along x-axis Shear
More informationThe Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes
The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes What is it? The viewing pipeline is the procession of operations that are applied to the OpenGL matrices, in order to create a 2D representation
More informationComputer Graphics. Chapter 5 Geometric Transformations. Somsak Walairacht, Computer Engineering, KMITL
Chapter 5 Geometric Transformations Somsak Walairacht, Computer Engineering, KMITL 1 Outline Basic Two-Dimensional Geometric Transformations Matrix Representations and Homogeneous Coordinates Inverse Transformations
More informationReading. Hierarchical Modeling. Symbols and instances. Required: Angel, sections , 9.8. Optional:
Reading Required: Angel, sections 9.1 9.6, 9.8 Optional: Hierarchical Modeling OpenGL rogramming Guide, the Red Book, chapter 3 cse457-07-hierarchical 1 cse457-07-hierarchical 2 Symbols and instances Most
More informationObject Representation Affine Transforms. Polygonal Representation. Polygonal Representation. Polygonal Representation of Objects
Object Representation Affine Transforms Polygonal Representation of Objects Although perceivable the simplest form of representation they can also be the most problematic. To represent an object polygonally,
More informationVertex Buffer Objects and Transformations Week 4
CS 432/637 INTERACTIVE COMPUTER GRAPHICS Vertex Buffer Objects and Transformations Week 4 David Breen Department of Computer Science Drexel University Based on material from Ed Angel, University of New
More informationTranslation. 3D Transformations. Rotation about z axis. Scaling. CS 4620 Lecture 8. 3 Cornell CS4620 Fall 2009!Lecture 8
Translation 3D Transformations CS 4620 Lecture 8 1 2 Scaling Rotation about z axis 3 4 Rotation about x axis Rotation about y axis 5 6 Transformations in OpenGL Stack-based manipulation of model-view transformation,
More informationComputer Graphics. Chapter 10 Three-Dimensional Viewing
Computer Graphics Chapter 10 Three-Dimensional Viewing Chapter 10 Three-Dimensional Viewing Part I. Overview of 3D Viewing Concept 3D Viewing Pipeline vs. OpenGL Pipeline 3D Viewing-Coordinate Parameters
More informationLecture 5b. Transformation
Lecture 5b Transformation Refresher Transformation matrices [4 x 4]: the fourth coordinate is homogenous coordinate. Rotation Transformation: Axis of rotation must through origin (0,0,0). If not, translation
More informationBooks, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D
Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D CS334 Spring 2012 Daniel G. Aliaga Department of Computer Science Purdue University Computer Graphics Pipeline Geometric Primitives
More informationCS 591B Lecture 9: The OpenGL Rendering Pipeline
CS 591B Lecture 9: The OpenGL Rendering Pipeline 3D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination Spring 2007 Rui Wang 3D Polygon Rendering Many applications
More informationPrecept 2 Aleksey Boyko February 18, 2011
Precept 2 Aleksey Boyko February 18, 2011 Getting started Initialization Drawing Transformations Cameras Animation Input Keyboard Mouse Joystick? Textures Lights Programmable pipeline elements (shaders)
More informationTransformation, Input and Interaction. Hanyang University
Transformation, Input and Interaction Hanyang University Transformation, projection, viewing Pipeline of transformations Standard sequence of transforms Cornell CS4620 Fall 2008 Lecture 8 3 2008 Steve
More information2/3/16. Interaction. Triangles (Clarification) Choice of Programming Language. Buffer Objects. The CPU-GPU bus. CSCI 420 Computer Graphics Lecture 3
CSCI 420 Computer Graphics Lecture 3 Interaction Jernej Barbic University of Southern California [Angel Ch. 2] Triangles (Clarification) Can be any shape or size Well-shaped triangles have advantages for
More informationInteraction. CSCI 420 Computer Graphics Lecture 3
CSCI 420 Computer Graphics Lecture 3 Interaction Jernej Barbic University of Southern California Client/Server Model Callbacks Double Buffering Hidden Surface Removal Simple Transformations [Angel Ch.
More informationComputer Graphics. Transformations. CSC 470 Computer Graphics 1
Computer Graphics Transformations CSC 47 Computer Graphics 1 Today s Lecture Transformations How to: Rotate Scale and Translate 2 Introduction An important concept in computer graphics is Affine Transformations.
More informationGL_MODELVIEW transformation
lecture 3 view transformations model transformations GL_MODELVIEW transformation view transformations: How do we map from world coordinates to camera/view/eye coordinates? model transformations: How do
More informationModeling with Transformations
Modeling with Transformations Prerequisites This module requires some understanding of 3D geometry, particularly a sense of how objects can be moved around in 3-space. The student should also have some
More informationFundamental Types of Viewing
Viewings Fundamental Types of Viewing Perspective views finite COP (center of projection) Parallel views COP at infinity DOP (direction of projection) perspective view parallel view Classical Viewing Specific
More informationOpenGL/GLUT Intro. Week 1, Fri Jan 12
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner OpenGL/GLUT Intro Week 1, Fri Jan 12 http://www.ugrad.cs.ubc.ca/~cs314/vjan2007 News Labs start next week Reminder:
More informationTransformations Computer Graphics I Lecture 4
15-462 Computer Graphics I Lecture 4 Transformations Vector Spaces Affine and Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices January 23, 2003 [Angel, Ch. 4] Frank Pfenning Carnegie
More informationScene Graphs. CS4620/5620: Lecture 7. Announcements. HW 1 out. PA 1 will be out on Wed
CS4620/5620: Lecture 7 Scene Graphs 1 Announcements HW 1 out PA 1 will be out on Wed Next week practicum will have an office hour type session on Open GL 2 Example Can represent drawing with flat list
More information// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations
#include int main(int argc, char** argv) { glutinit(&argc, argv); Typical OpenGL/GLUT Main Program // GLUT, GLU, and OpenGL defs // program arguments // initialize glut and gl // double buffering
More informationComputer graphics MN1
Computer graphics MN1 http://www.opengl.org Todays lecture What is OpenGL? How do I use it? Rendering pipeline Points, vertices, lines,, polygons Matrices and transformations Lighting and shading Code
More informationBooks, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt
Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt CS334 Fall 2015 Daniel G. Aliaga Department of Computer Science Purdue University Books (and by now means complete ) Interactive Computer
More information1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1
Transformations 1-1 Transformations are used within the entire viewing pipeline: Projection from world to view coordinate system View modifications: Panning Zooming Rotation 1-2 Transformations can also
More informationDescribe the Orthographic and Perspective projections. How do we combine together transform matrices?
Aims and objectives By the end of the lecture you will be able to Work with multiple transform matrices Describe the viewing process in OpenGL Design and build a camera control APIs Describe the Orthographic
More informationCS Computer Graphics: Transformations & The Synthetic Camera
CS 543 - Computer Graphics: Transformations The Snthetic Camera b Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) Introduction to Transformations A transformation changes an objects Size
More informationFachhochschule Regensburg, Germany, February 15, 2017
s Operations Fachhochschule Regensburg, Germany, February 15, 2017 s Motivating Example s Operations To take a photograph of a scene: Set up your tripod and point camera at the scene (Viewing ) Position
More informationOpenGL Transformations
OpenGL Transformations R. J. Renka Department of Computer Science & Engineering University of North Texas 02/18/2014 Introduction The most essential aspect of OpenGL is the vertex pipeline described in
More information3D Transformation. In 3D, we have x, y, and z. We will continue use column vectors:. Homogenous systems:. x y z. x y z. glvertex3f(x, y,z);
3D Transformation In 3D, we have x, y, and z. We will continue use column vectors:. Homogenous systems:. 3D Transformation glvertex3f(x, y,z); x y z x y z A Right Handle Coordinate System x y z; y z x;
More information3D Graphics Pipeline II Clipping. Instructor Stephen J. Guy
3D Graphics Pipeline II Clipping Instructor Stephen J. Guy 3D Rendering Pipeline (for direct illumination) 3D Geometric Primitives 3D Model Primitives Modeling Transformation 3D World Coordinates Lighting
More informationCS4202: Test. 1. Write the letter corresponding to the library name next to the statement or statements that describe library.
CS4202: Test Name: 1. Write the letter corresponding to the library name next to the statement or statements that describe library. (4 points) A. GLUT contains routines that use lower level OpenGL commands
More informationCSCI E-74. Simulation and Gaming
CSCI E-74 Virtual and Augmented Reality for Simulation and Gaming Fall term 2017 Gianluca De Novi, PhD Lesson 3 General Introduction to OpenGL APIs and TRS Perspective Simulation Perspective simulation
More informationTransformations. Overview. Standard Transformations. David Carr Fundamentals of Computer Graphics Spring 2004 Based on Slides by E.
INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Transformations David Carr Fundamentals of Computer Graphics Spring 24 Based on Slides by E. Angel Feb-1-4 SMD159, Transformations 1 L Overview
More informationChapter 3: Modeling Transformation
Chapter 3: Modeling Transformation Graphics Programming, 8th Sep. Graphics and Media Lab. Seoul National University 2011 Fall OpenGL Steps Every step in the graphics pipeline is related to the transformation.
More informationCOMP3421. Week 2 - Transformations in 2D and Vector Geometry Revision
COMP3421 Week 2 - Transformations in 2D and Vector Geometry Revision Exercise 1. Write code to draw (an approximation) of the surface of a circle at centre 0,0 with radius 1 using triangle fans. Transformation
More information3D Viewing Episode 2
3D Viewing Episode 2 1 Positioning and Orienting the Camera Recall that our projection calculations, whether orthographic or frustum/perspective, were made with the camera at (0, 0, 0) looking down the
More informationHierarchical Modeling. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell
Hierarchical Modeling University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Reading Angel, sections 9.1-9.6 [reader pp. 169-185] OpenGL Programming Guide, chapter 3 Focus especially
More informationTransformations Computer Graphics I Lecture 4
15-462 Computer Graphics I Lecture 4 Transformations Vector Spaces Affine and Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices January 24, 2002 [Angel, Ch. 4] Frank Pfenning Carnegie
More informationComputer Graphics Hands-on
Computer Graphics Hands-on Two-Dimensional OpenGL Transformations Objectives To get hands-on experience manipulating the OpenGL current transformation (MODELVIEW) matrix to achieve desired effects To gain
More informationTransforms 1 Christian Miller CS Fall 2011
Transforms 1 Christian Miller CS 354 - Fall 2011 Transformations What happens if you multiply a square matrix and a vector together? You get a different vector with the same number of coordinates These
More informationSpring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013
Spring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013 PROJECT GOAL: Write a restricted OpenGL library. The goal of the project is to compute all the transformation matrices with your
More informationTransformation Pipeline
Transformation Pipeline Local (Object) Space Modeling World Space Clip Space Projection Eye Space Viewing Perspective divide NDC space Normalized l d Device Coordinatesd Viewport mapping Screen space Coordinate
More informationIntroduction to 3D Graphics with OpenGL. Z-Buffer Hidden Surface Removal. Binghamton University. EngiNet. Thomas J. Watson
Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced
More informationCS 428: Fall Introduction to. Transformations in OpenGL + hierarchical modeling. Andrew Nealen, Rutgers, /21/2009 1
CS 428: Fall 2009 Introduction to Computer Graphics Transformations in OpenGL + hierarchical modeling 9/21/2009 1 Review of affine transformations Use projective geometry staple of CG Euclidean (x,z) (x,y,z)
More informationGRAFIKA KOMPUTER. ~ M. Ali Fauzi
GRAFIKA KOMPUTER ~ M. Ali Fauzi Drawing 2D Graphics VIEWPORT TRANSFORMATION Recall :Coordinate System glutreshapefunc(reshape); void reshape(int w, int h) { glviewport(0,0,(glsizei) w, (GLsizei) h); glmatrixmode(gl_projection);
More informationIntroduction to Computer Graphics with WebGL
1 Introduction to Computer Graphics with WebGL Ed Angel Transformations General Transformations A transformation maps points to other points and/or vectors to other vectors v=t(u) Q=T(P) 2 Affine Transformations
More informationTransformations. CSCI 420 Computer Graphics Lecture 5
CSCI 420 Computer Graphics Lecture 5 Transformations Jernej Barbic University of Southern California Vector Spaces Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices [Angel, Ch. 3]
More informationTransformations. OpenGL Transformations. 4x4 Model-view Matrix (this lecture) OpenGL Transformation Matrices. 4x4 Projection Matrix (next lecture)
CSCI 420 Computer Graphics Lecture 5 OpenGL Transformations Transformations Vector Spaces Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices Jernej Barbic [Angel, Ch. 3] University
More informationLecture 3. Understanding of OPenGL programming
Lecture 3 Understanding of OPenGL programming What is OpenGL GL: stands for Graphic Library Software interface for rendering purposes for 2D or 3D geometric data objects. Various Pieces gl: The basic libraries.
More informationUNIT 2 2D TRANSFORMATIONS
UNIT 2 2D TRANSFORMATIONS Introduction With the procedures for displaying output primitives and their attributes, we can create variety of pictures and graphs. In many applications, there is also a need
More informationToday s class. Viewing transformation Menus Mandelbrot set and pixel drawing. Informationsteknologi
Today s class Viewing transformation Menus Mandelbrot set and pixel drawing Monday, November 2, 27 Computer Graphics - Class 7 The world & the window World coordinates describe the coordinate system used
More informationNotes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment
Notes on Assignment Notes on Assignment Objects on screen - made of primitives Primitives are points, lines, polygons - watch vertex ordering The main object you need is a box When the MODELVIEW matrix
More informationCS 4204 Computer Graphics
CS 4204 Computer Graphics 3D Viewing and Projection Yong Cao Virginia Tech Objective We will develop methods to camera through scenes. We will develop mathematical tools to handle perspective projection.
More informationInput and Interaction. 1. Interaction. Chapter 3. Introduction: - We now turn to the development of interactive graphics programs.
Input and Interaction Chapter 3 Introduction: - We now turn to the development of interactive graphics programs. - Our discussion has three main parts First, we consider the variety of devices available
More informationComputer Graphics 7: Viewing in 3-D
Computer Graphics 7: Viewing in 3-D In today s lecture we are going to have a look at: Transformations in 3-D How do transformations in 3-D work? Contents 3-D homogeneous coordinates and matrix based transformations
More informationChapter 5. Transformations of Objects
Chapter 5. Transformations of Objects Minus times minus is plus, the reason for this we need not discuss W.H.Auden If I eat one of these cakes, she thought, it's sure to make some change in my size. So
More informationC++ is Fun Part 13 at Turbine/Warner Bros.! Russell Hanson
C++ is Fun Part 13 at Turbine/Warner Bros.! Russell Hanson Syllabus 1) First program and introduction to data types and control structures with applications for games learning how to use the programming
More informationGraphics and Visualization
International University Bremen Spring Semester 2006 Recap Representing graphic objects by homogenous points and vectors Using affine transforms to modify objects Using projections to display objects
More informationComputer Graphics. Bing-Yu Chen National Taiwan University
Computer Graphics Bing-Yu Chen National Taiwan University Introduction to OpenGL General OpenGL Introduction An Example OpenGL Program Drawing with OpenGL Transformations Animation and Depth Buffering
More informationTo Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3)
Computer Graphics (Fall 2008) COMS 4160, Lecture 9: OpenGL 1 http://www.cs.columbia.edu/~cs4160 To Do Start thinking (now) about HW 3. Milestones are due soon. Course Course 3D Graphics Pipeline 3D Graphics
More informationTransformations. Prof. George Wolberg Dept. of Computer Science City College of New York
Transforations Prof. George Wolberg Dept. of Coputer Science City College of New York Objectives Introduce standard transforations - Rotations - Translation - Scaling - Shear Derive hoogeneous coordinate
More information2D/3D Geometric Transformations and Scene Graphs
2D/3D Geometric Transformations and Scene Graphs Week 4 Acknowledgement: The course slides are adapted from the slides prepared by Steve Marschner of Cornell University 1 A little quick math background
More informationLecture 2 2D transformations Introduction to OpenGL
Lecture 2 2D transformations Introduction to OpenGL OpenGL where it fits what it contains how you work with it OpenGL parts: GL = Graphics Library (core lib) GLU = GL Utilities (always present) GLX, AGL,
More informationVisualizing Molecular Dynamics
Visualizing Molecular Dynamics Aiichiro Nakano Collaboratory for Advanced Computing & Simulations Department of Computer Science Department of Physics & Astronomy Department of Chemical Engineering & Materials
More informationOpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL
OpenGL: Open Graphics Library Introduction to OpenGL Part II CS 351-50 Graphics API ( Application Programming Interface) Software library Layer between programmer and graphics hardware (and other software
More informationOpenGL for dummies hello.c #include int main(int argc, char** argv) { glutinit(&argc, argv); glutinitdisplaymode (GLUT_SINGLE GLUT_RGB); glutinitwindowsize (250, 250); glutinitwindowposition
More informationUlf Assarsson Department of Computer Engineering Chalmers University of Technology
Ulf Assarsson Department of Computer Engineering Chalmers University of Technology 1. I am located in room 4115 in EDIT-huset 2. Email: 3. Phone: 031-772 1775 (office) 4. Course assistant: Tomas Akenine-Mőller
More informationLecture 4. Viewing, Projection and Viewport Transformations
Notes on Assignment Notes on Assignment Hw2 is dependent on hw1 so hw1 and hw2 will be graded together i.e. You have time to finish both by next monday 11:59p Email list issues - please cc: elif@cs.nyu.edu
More information蔡侑庭 (Yu-Ting Tsai) National Chiao Tung University, Taiwan. Prof. Wen-Chieh Lin s CG Slides OpenGL 2.1 Specification
蔡侑庭 (Yu-Ting Tsai) Department of Computer Science National Chiao Tung University, Taiwan Prof. Wen-Chieh Lin s CG Slides OpenGL 2.1 Specification OpenGL Programming Guide, Chap. 3 & Appendix F 2 OpenGL
More informationTransformations. Standard Transformations. David Carr Virtual Environments, Fundamentals Spring 2005 Based on Slides by E. Angel
INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Transformations David Carr Virtual Environments, Fundamentals Spring 25 Based on Slides by E. Angel Jan-27-5 SMM9, Transformations 1 L Overview
More information6. Modelview Transformations
6. Modelview Transformations Transformation Basics Transformations map coordinates from one frame of reference to another through matri multiplications Basic transformation operations include: - translation
More informationGetting Started. Overview (1): Getting Started (1): Getting Started (2): Getting Started (3): COSC 4431/5331 Computer Graphics.
Overview (1): Getting Started Setting up OpenGL/GLUT on Windows/Visual Studio COSC 4431/5331 Computer Graphics Thursday January 22, 2004 Overview Introduction Camera analogy Matrix operations and OpenGL
More informationCOMP 175 COMPUTER GRAPHICS. Lecture 07: Scene Graph. COMP 175: Computer Graphics March 10, Remco Chang 07 Scene Graph
Lecture 07: Scene Graph COMP 175: Computer Graphics March 10, 2015 1/47 Refresher: OpenGL Matrix Transformation Pipeline Input: list of 3D coordinates (x, y, z) GL_MODELVIEW Model transform View transform
More information