Affine Transformations in 3D

Size: px
Start display at page:

Download "Affine Transformations in 3D"

Transcription

1 Affine Transformations in 3D 1

2 Affine Transformations in 3D 1

3 Affine Transformations in 3D General form 2

4 Translation Elementary 3D Affine Transformations 3

5 Scaling Around the Origin 4

6 Along x-axis Shear around the origin 5

7 3 DRotation Various representations Decomposition into axis rotations (x-roll, y-roll, z-roll) CCW positive assumption 6

8 Reminder 2D z-rotation 7

9 Three axis to rotate around 8

10 Z-roll 9

11 X-roll Cyclic indexing 10

12 Y-roll 11

13 Rigid body transformations Translations and rotations Preserve lines, angles and distances 12

14 Inversion of transformations Translation: T -1 (a,b,c) = T(-a,-b,-c) Rotation: R -1 axis (b) = R axis {-b) Scaling: S -1 (sx,sy,sz) = S(1/sx,1/sy,1/sz) Shearing: Sh -1 (a) = Sh(-a) 13

15 Inverse of Rotations Pure rotation only, no scaling or shear. 14

16 Composition of 3D Affine Transformations The composition of affine transformations is an affine transformation. Any 3D affine transformation can be performed as a series of elementary affine transformations. 15

17 Composite 3D Rotation around origin The order is important!! It is often convenient to use other representations for 3D rotations. 16

18 Gimball lock 17

19 Loss of degree of freedom 18

20 Rotation around an arbitrary axis Euler s theorem: Any rotation or sequence of rotations around a point is equivalent to a single rotation around an axis that passes through the point. What does the matrix look like? 19

21 Rotation around an arbitrary axis Axis: u Point: P Angle:! Method: 1. Two rotations to align u with x-axis 2. Do x-roll by! 3. Undo the alignment 20

22 Derivation 1. R z (-")R y (#) 2. R x (!) 3. R y (-#)R z (") Altogether: R y (-#)R z (") R x (!) R z (-")R y (#) We can add translation too if the axis is not through the origin 21

23 Properties of affine transformations 1. Preservation of affine combinations of points. 2. Preservation of lines and planes. 3. Preservation of parallelism of lines and planes. 4. Relative ratios on a line are preserved. 5. Affine transformations are composed of elementary ones. 22

24 Affine Combinations of Points 23

25 Preservations of Lines and Planes 24

26 Preservation of Parallelism 25

27 General form Rotation, Scaling, Shear Translation 26

28 Advanced concepts Generalized shears Decomposition of 2D AT: 2D : M = T Sh S R 3D: M = T S R Sh 1 Sh 2 Rotations in 3D Gimbal lock Quaternions Exponential maps 27

29 Transformations of Coordinate systems Coordinate systems consist of vectors and an origin, therefore we can transform them just like points and vectors. Alternative way to think of transformations. 28

30 Reminder: Coordinate systems Coordinate system: (a,b,c,!) 29

31 Reminder: The homogeneous representation of points and vectors 30

32 Transforming CS1 into CS2 What is the relationship between P in CS2 and P in CS1 if CS2 = T(CS1)? y b e P CS1 j O i CS2 j O a i d x 31

33 Derivation 32

34 Derivation 33

35 P in CS1 vs P in CS2 Proof in pages 245,246 of [Hill] b y e P j O i j O a i d x 34

36 Successive transformations of CS CS1! CS2! CS3 y P T1 T2 j j O i O i x 35

37 Transformations as a change of basis CS1 CS2 We know the basis vectors and we know that What is M with respect to the basis vectors? 36

38 Transformations as a change of basis CS1 CS2 That is: We can view transformations as a change of coodinate system 37

39 Transforming a point through transforming coordinate systems 38

40 Transforming a point through transforming coordinate systems 39

41 Transforming a point through transforming coordinate systems 40

42 Transforming a point P: Transformations: T1,T2,T3 Matrix: M = M3 x M2 x M1 Point transformed by: MP Rule of thumb Succesive transformations happen with respect to the same CS Transforming a CS Transformations: T1, T2, T3 Matrix: M = M1 x M2 x M3 A point has original coordinates MP Each transformations happens with respect to the new CS. 41

43 Rule of thumb To find the transformation matrix that transforms P from CSA coordinates to CSB coordinates, we find the sequence of transformations that align CSB to CSA accumulating matrices from left to right. 42

44 Explanation of this rule If we think transforming systems, M takes CS A from the left and produces B on the right. A M B Transformation M: A M B After this transformation we talk in B coordinates (right side). P If we think about points then we move the other way. M takes B on the right and produces the A coordinates on the left: CS A CS B A M B 43

45 Explanation of this rule Transformation M: A M B CS A CS B P Take this simple example where to produce B we translate A by 1 on x axis. P B = (1,1) P A = (2,1) If we move A by +1 to transform it into B then the coordinates of P with respect to the new system are shortened by 1 (B is closer to P than A by 1). So if we want to transform the coordinates of P from B to A we need to add 1 in x. Exactly what we need to do to transform system A to B. 44

46 Graphics Pipeline OCS WCS VCS CCS Modeling transformation Viewing transformation Projection transformation DCS Viewport transformation NDCS Perspective division 45

47 Translation in OpenGL gltranslate3f(glfloat x, GLfloat y, GLfloat z) ; gltranslate3d(gldouble x, GLdouble y, GLdouble z); 46

48 Scaling in OpenGL glscalef(glfloat sx, GLfloat sy, GLfloat sz) ; glscaled(gldouble sx, GLdouble sy, GLdouble sz) ; 47

49 Rotation in OpenGL glrotatef(glfloat angle, GLfloat x, GLfloat y, GLfloat z) ; glrotated(gldouble angle, GLdouble ux, GLdouble uy, GLdouble uz) ; (Matrix in the next slide) 48

50 Matrix created 1. R z (-")R y (#) 2. R x (!) 3. R y (-#)R z (") Altogether: R y (-#)R z (") R x (!) R z (-")R y (#) We can add translation too if the axis is not through the origin 49

51 Composition of transformations in OpenGL Successively transforming the coordinate system M = M1 M2 M3. Mn Pwolrd = M Pobj 50

52 OpengGL Modelview Matrix Each transformation post multiplies the current modelview matrix CM glmatrixmode(gl_modelview) ; glloadidentity() ; // CM = I glrotatef(45, 0,0,1) ; // CM = I*Rz(45) ; gltranslatef(1,1,1) ; glscale(2,1,1) ; // CM = CM*T(1,1,1) // = I*Rz(45) *T(1,1,1) // CM = CM *S(2,1,1) = I*Rz*T*S 51

53 Arbitrary matrices Arbitrary affine (or not) transformations glloadmatrixf(glfloat *M) ; // CM = M glloadmatrixd(gldouble *M) ; // CM = M glmultmatrixf(glfloat *M) ; // CM = CM*M glmultmatrixd(glfloat *M) ; // CM = CM*M 52

54 Tricky Point There are no multi-dimensional arrays in c. Column-major order vs. row-major order. OpenGL uses column major order that is: 53

55 Feedback GLdouble m[16] ; glgetdoublev(gl_modelview_matrix,m) ; GLfloat m[16] ; glgetfloatv(gl_modelview_matrix,m) ; 54

56 Why a stack? Matrix Stack Reuse of transformations Control the effect of transformations Hierarchical structures Manipulating the stack glpushmatrix() ; glpopmatrix() ; 55

57 Example Wrist and 5 fingers We want the fingers to stay attached to the wrist as the wrist moves. Wrist F1_1 F1_2 F1_3 56

58 Hierarchy CSwrist Twrist Wrist T1_1 Wrist F1_1 T1_2 F1_1 F1_2 F1_2 T1_3 F1_3 F1_3 CSwolrd 57

59 Hierarchy CSF1_1 = T1_1(CSwrist) CSF1_2 = T1_2(CSF1_1) CSF1_3 = T1_3(CSF1_2) Wrist CSwrist F1_1 F1_2 F1_3 CSwolrd 58

60 Examples on the computer 59

61 How to think about transformations OpenGL code Transformations of coordinate systems TOP to BOTTOM Transformations of objects BOTTOM to TOP Which one do we use to think of transformations? Whichever we like Usually both 60

62 Example: Given a unit cube center at the origin create a cube as shown in the next slide 61

63 62

64 63

65 64

66 65

67 66

68 67

69 68

70 69

71 70

72 71

73 72

74 Hybrid way of thinking Use TOP to BOTTOM to position a coordinate system Then use BOTTOM to TOP to position the objects within that system Often it is easier to do it in the opposite order 73

75 Graphics Pipeline M -1 cam OCS WCS VCS CCS Modeling transformation Viewing transformation Projection transformation DCS Viewport transformation NDCS Perspective division 74

76 Taking a snapshot of a 3D Scene 75

77 OpenGL Assumption In world coordinates the camera system is: 76

78 Camera transformation (Hill ) Transforms objects to camera coordinates OpenGL Modelview matrix 77

79 Common way Eye point Reference point Upvector Defining Mcam To build Mcam we need to define a camera coordinate system (origin, i, j, k) 78

80 Camera Coordinate system 79

81 Building Mcam Change of basis Our reference system is WCS, we know the camera parameters with respect to the world Align WCS with VCS VCS P eye WCS y z x 80

82 Invert smart Building Mcam inverse 81

83 Invert smart Building Mcam inverse Transpose 82

84 Camera in OpenGL glulookat(ex,ey,ez,rx,ry,rz,ux,uy,uz) The resulting matrix pre-multiplies the modelview matrix! glmatrixmode(gl_modelview); glloadidentity(); glulookat(ex,ey,ez,rx,ry,rz,ux,uy,uz);! // setup modelling transformations here 83

85 End of Modeling transformations 1. Preservation of affine combinations of points. 2. Preservation of lines and planes. 3. Preservation of parallelism of lines and planes. 4. Relative ratios on a line are preserved 5. Affine transformations are composed of elementary ones. Camera transformation as a change of basis. OpenGL matrix stack. 84

Translation. 3D Transformations. Rotation about z axis. Scaling. CS 4620 Lecture 8. 3 Cornell CS4620 Fall 2009!Lecture 8

Translation. 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 information

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1

1 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 information

CSC 470 Computer Graphics

CSC 470 Computer Graphics CSC 470 Computer Graphics Transformations of Objects CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 1 Transformations of objects - 2D CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 2 Using

More information

Scene Graphs. CS4620/5620: Lecture 7. Announcements. HW 1 out. PA 1 will be out on Wed

Scene 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

Computer Graphics Geometric Transformations

Computer 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 information

CS 428: Fall Introduction to. Transformations in OpenGL + hierarchical modeling. Andrew Nealen, Rutgers, /21/2009 1

CS 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 information

3D Transformations. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 11

3D Transformations. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 11 3D Transformations CS 4620 Lecture 11 1 Announcements A2 due tomorrow Demos on Monday Please sign up for a slot Post on piazza 2 Translation 3 Scaling 4 Rotation about z axis 5 Rotation about x axis 6

More information

Transforms 1 Christian Miller CS Fall 2011

Transforms 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 information

CSCI E-74. Simulation and Gaming

CSCI 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 information

Computer Graphics. Chapter 7 2D Geometric Transformations

Computer 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 information

CS 4204 Computer Graphics

CS 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 information

3D Viewing Episode 2

3D 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 information

Transforms. COMP 575/770 Spring 2013

Transforms. COMP 575/770 Spring 2013 Transforms COMP 575/770 Spring 2013 Transforming Geometry Given any set of points S Could be a 2D shape, a 3D object A transform is a function T that modifies all points in S: T S S T v v S Different transforms

More information

Fachhochschule Regensburg, Germany, February 15, 2017

Fachhochschule 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 information

Geometric transformations in 3D and coordinate frames. Computer Graphics CSE 167 Lecture 3

Geometric transformations in 3D and coordinate frames. Computer Graphics CSE 167 Lecture 3 Geometric transformations in 3D and coordinate frames Computer Graphics CSE 167 Lecture 3 CSE 167: Computer Graphics 3D points as vectors Geometric transformations in 3D Coordinate frames CSE 167, Winter

More information

3D Transformations. CS 4620 Lecture 10. Cornell CS4620 Fall 2014 Lecture Steve Marschner (with previous instructors James/Bala)

3D Transformations. CS 4620 Lecture 10. Cornell CS4620 Fall 2014 Lecture Steve Marschner (with previous instructors James/Bala) 3D Transformations CS 4620 Lecture 10 1 Translation 2 Scaling 3 Rotation about z axis 4 Rotation about x axis 5 Rotation about y axis 6 Properties of Matrices Translations: linear part is the identity

More information

3D Viewing Episode 2

3D 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 information

2D/3D Geometric Transformations and Scene Graphs

2D/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 information

OpenGL Transformations

OpenGL 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 information

CS D Transformation. Junqiao Zhao 赵君峤

CS 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 information

CS354 Computer Graphics Viewing and Modeling

CS354 Computer Graphics Viewing and Modeling Slide Credit: Donald S. Fussell CS354 Computer Graphics Viewing and Modeling Qixing Huang February 21th 2018 Computer Viewing There are three aspects of the viewing process, all of which are implemented

More information

Today. Today. Introduction. Matrices. Matrices. Computergrafik. Transformations & matrices Introduction Matrices

Today. Today. Introduction. Matrices. Matrices. Computergrafik. Transformations & matrices Introduction Matrices Computergrafik Matthias Zwicker Universität Bern Herbst 2008 Today Transformations & matrices Introduction Matrices Homogeneous Affine transformations Concatenating transformations Change of Common coordinate

More information

Lecture 4: Transformations and Matrices. CSE Computer Graphics (Fall 2010)

Lecture 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 information

Computer Viewing Computer Graphics I, Fall 2008

Computer Viewing Computer Graphics I, Fall 2008 Computer Viewing 1 Objectives Introduce mathematics of projection Introduce OpenGL viewing functions Look at alternate viewing APIs 2 Computer Viewing Three aspects of viewing process All implemented in

More information

Geometric Transformations

Geometric Transformations Geometric Transformations CS 4620 Lecture 9 2017 Steve Marschner 1 A little quick math background Notation for sets, functions, mappings Linear and affine transformations Matrices Matrix-vector multiplication

More information

Viewing and Projection

Viewing and Projection 15-462 Computer Graphics I Lecture 5 Viewing and Projection Shear Transformation Camera Positioning Simple Parallel Projections Simple Perspective Projections [Angel, Ch. 5.2-5.4] January 30, 2003 [Red

More information

Graphics pipeline and transformations. Composition of transformations

Graphics pipeline and transformations. Composition of transformations Graphics pipeline and transformations Composition of transformations Order matters! ( rotation * translation translation * rotation) Composition of transformations = matrix multiplication: if T is a rotation

More information

GL_MODELVIEW transformation

GL_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 information

Chapter 3: Modeling Transformation

Chapter 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 information

CS 4204 Computer Graphics

CS 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 information

COMP Computer Graphics and Image Processing. 5: Viewing 1: The camera. In part 1 of our study of Viewing, we ll look at ˆʹ U ˆ ʹ F ˆʹ S

COMP Computer Graphics and Image Processing. 5: Viewing 1: The camera. In part 1 of our study of Viewing, we ll look at ˆʹ U ˆ ʹ F ˆʹ S COMP27112 Û ˆF Ŝ Computer Graphics and Image Processing ˆʹ U ˆ ʹ F C E 5: iewing 1: The camera ˆʹ S Toby.Howard@manchester.ac.uk 1 Introduction In part 1 of our study of iewing, we ll look at iewing in

More information

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6 Math background 2D Geometric Transformations CS 4620 Lecture 6 Read: Chapter 2: Miscellaneous Math Chapter 5: Linear Algebra Notation for sets, functions, mappings Linear transformations Matrices Matrix-vector

More information

For each question, indicate whether the statement is true or false by circling T or F, respectively.

For each question, indicate whether the statement is true or false by circling T or F, respectively. True/False For each question, indicate whether the statement is true or false by circling T or F, respectively. 1. (T/F) Rasterization occurs before vertex transformation in the graphics pipeline. 2. (T/F)

More information

COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective

COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective Department of Computing and Information Systems The Lecture outline Introduction Rotation about artibrary axis

More information

The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes

The 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 information

Transformations Week 9, Lecture 18

Transformations Week 9, Lecture 18 CS 536 Computer Graphics Transformations Week 9, Lecture 18 2D Transformations David Breen, William Regli and Maxim Peysakhov Department of Computer Science Drexel University 1 3 2D Affine Transformations

More information

3D Viewing. CS 4620 Lecture 8

3D Viewing. CS 4620 Lecture 8 3D Viewing CS 46 Lecture 8 13 Steve Marschner 1 Viewing, backward and forward So far have used the backward approach to viewing start from pixel ask what part of scene projects to pixel explicitly construct

More information

Overview. By end of the week:

Overview. By end of the week: Overview By end of the week: - Know the basics of git - Make sure we can all compile and run a C++/ OpenGL program - Understand the OpenGL rendering pipeline - Understand how matrices are used for geometric

More information

Monday, 12 November 12. Matrices

Monday, 12 November 12. Matrices Matrices Matrices Matrices are convenient way of storing multiple quantities or functions They are stored in a table like structure where each element will contain a numeric value that can be the result

More information

CS4620/5620. Professor: Kavita Bala. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

CS4620/5620. Professor: Kavita Bala. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner) CS4620/5620 Affine and 3D Transformations Professor: Kavita Bala 1 Announcements Updated schedule on course web page 2 Prelim days finalized and posted Oct 11, Nov 29 No final exam, final project will

More information

GEOMETRIC TRANSFORMATIONS AND VIEWING

GEOMETRIC TRANSFORMATIONS AND VIEWING GEOMETRIC TRANSFORMATIONS AND VIEWING 2D and 3D 1/44 2D TRANSFORMATIONS HOMOGENIZED Transformation Scaling Rotation Translation Matrix s x s y cosθ sinθ sinθ cosθ 1 dx 1 dy These 3 transformations are

More information

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment

Notes 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 information

Lecture 4. Viewing, Projection and Viewport Transformations

Lecture 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

Computer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Computer 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 information

Spring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013

Spring 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 information

Describe the Orthographic and Perspective projections. How do we combine together transform matrices?

Describe 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 information

Two possible ways to specify transformations. Each part of the object is transformed independently relative to the origin

Two possible ways to specify transformations. Each part of the object is transformed independently relative to the origin Transformations Two possible ways to specify transformations Each part of the object is transformed independently relative to the origin - Not convenient! z y Translate the base by (5,0,0); Translate the

More information

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T Copyright 2018 Sung-eui Yoon, KAIST freely available on the internet http://sglab.kaist.ac.kr/~sungeui/render

More information

Fall CSCI 420: Computer Graphics. 2.2 Transformations. Hao Li.

Fall 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 information

CS230 : Computer Graphics Lecture 6: Viewing Transformations. Tamar Shinar Computer Science & Engineering UC Riverside

CS230 : Computer Graphics Lecture 6: Viewing Transformations. Tamar Shinar Computer Science & Engineering UC Riverside CS230 : Computer Graphics Lecture 6: Viewing Transformations Tamar Shinar Computer Science & Engineering UC Riverside Rendering approaches 1. image-oriented foreach pixel... 2. object-oriented foreach

More information

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CSE528 Computer Graphics: Theory, Algorithms, and Applications CSE528 Computer Graphics: Theory, Algorithms, and Applications Hong Qin Stony Brook University (SUNY at Stony Brook) Stony Brook, New York 11794-2424 Tel: (631)632-845; Fax: (631)632-8334 qin@cs.stonybrook.edu

More information

Last week. Machiraju/Zhang/Möller/Fuhrmann

Last week. Machiraju/Zhang/Möller/Fuhrmann Last week Machiraju/Zhang/Möller/Fuhrmann 1 Geometry basics Scalar, point, and vector Vector space and affine space Basic point and vector operations Sided-ness test Lines, planes, and triangles Linear

More information

Object Representation Affine Transforms. Polygonal Representation. Polygonal Representation. Polygonal Representation of Objects

Object 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 information

Chapter 3 - Basic Mathematics for 3D Computer Graphics

Chapter 3 - Basic Mathematics for 3D Computer Graphics Chapter 3 - Basic Mathematics for 3D Computer Graphics Three-Dimensional Geometric Transformations Affine Transformations and Homogeneous Coordinates OpenGL Matrix Logic Translation Add a vector t Geometrical

More information

Local Illumination physics. Law of reflection and Snell s law of refraction

Local Illumination physics. Law of reflection and Snell s law of refraction Local Illumination physics Law of reflection and Snell s law of refraction What are we trying to model? Surface Proof of Lambert s cosine law n db da Computing R All vectors unit length!! The effect

More information

Advanced Computer Graphics Transformations. Matthias Teschner

Advanced Computer Graphics Transformations. Matthias Teschner Advanced Computer Graphics Transformations Matthias Teschner Motivation Transformations are used To convert between arbitrary spaces, e.g. world space and other spaces, such as object space, camera space

More information

Lecture 5b. Transformation

Lecture 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 information

Order of Transformations

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 information

Homogeneous Coordinates

Homogeneous Coordinates COMS W4172 3D Math 2 Steven Feiner Department of Computer Science Columbia Universit New York, NY 127 www.cs.columbia.edu/graphics/courses/csw4172 Februar 1, 218 1 Homogeneous Coordinates w X W Y X W Y

More information

Lecture 6 Sections 4.3, 4.6, 4.7. Wed, Sep 9, 2009

Lecture 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 information

Today. Parity. General Polygons? Non-Zero Winding Rule. Winding Numbers. CS559 Lecture 11 Polygons, Transformations

Today. Parity. General Polygons? Non-Zero Winding Rule. Winding Numbers. CS559 Lecture 11 Polygons, Transformations CS559 Lecture Polygons, Transformations These are course notes (not used as slides) Written by Mike Gleicher, Oct. 005 With some slides adapted from the notes of Stephen Chenney Final version (after class)

More information

Computer Graphics. Chapter 5 Geometric Transformations. Somsak Walairacht, Computer Engineering, KMITL

Computer 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 information

Hierarchical 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 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 information

CS4202: Test. 1. Write the letter corresponding to the library name next to the statement or statements that describe library.

CS4202: 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 information

Computer Graphics. Coordinate Systems and Change of Frames. Based on slides by Dianna Xu, Bryn Mawr College

Computer Graphics. Coordinate Systems and Change of Frames. Based on slides by Dianna Xu, Bryn Mawr College Computer Graphics Coordinate Systems and Change of Frames Based on slides by Dianna Xu, Bryn Mawr College Linear Independence A set of vectors independent if is linearly If a set of vectors is linearly

More information

Transformation. Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering

Transformation. Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering RBE 550 MOTION PLANNING BASED ON DR. DMITRY BERENSON S RBE 550 Transformation Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering http://users.wpi.edu/~zli11 Announcement Project

More information

Lecture 5: Viewing. CSE Computer Graphics (Fall 2010)

Lecture 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 information

Transformations. CSCI 420 Computer Graphics Lecture 4

Transformations. 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 information

Viewing and Projection

Viewing and Projection CSCI 480 Computer Graphics Lecture 5 Viewing and Projection January 25, 2012 Jernej Barbic University of Southern California Shear Transformation Camera Positioning Simple Parallel Projections Simple Perspective

More information

Perspective transformations

Perspective transformations Perspective transformations Transformation pipeline Modelview: model (position objects) + view (position the camera) Projection: map viewing volume to a standard cube Perspective division: project D to

More information

CSE328 Fundamentals of Computer Graphics

CSE328 Fundamentals of Computer Graphics CSE328 Fundamentals of Computer Graphics Hong Qin State University of New York at Stony Brook (Stony Brook University) Stony Brook, New York 794--44 Tel: (63)632-845; Fax: (63)632-8334 qin@cs.sunysb.edu

More information

3.1 Viewing and Projection

3.1 Viewing and Projection Fall 2017 CSCI 420: Computer Graphics 3.1 Viewing and Projection Hao Li http://cs420.hao-li.com 1 Recall: Affine Transformations Given a point [xyz] > form homogeneous coordinates [xyz1] > The transformed

More information

Transformation Pipeline

Transformation 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 information

Fundamental Types of Viewing

Fundamental 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 information

COMP3421. Introduction to 3D Graphics

COMP3421. Introduction to 3D Graphics COMP3421 Introduction to 3D Graphics 3D coodinates Moving to 3D is simply a matter of adding an extra dimension to our points and vectors: 3D coordinates 3D coordinate systems can be left or right handed.

More information

Overview. Viewing and perspectives. Planar Geometric Projections. Classical Viewing. Classical views Computer viewing Perspective normalization

Overview. Viewing and perspectives. Planar Geometric Projections. Classical Viewing. Classical views Computer viewing Perspective normalization Overview Viewing and perspectives Classical views Computer viewing Perspective normalization Classical Viewing Viewing requires three basic elements One or more objects A viewer with a projection surface

More information

Geometric transformations assign a point to a point, so it is a point valued function of points. Geometric transformation may destroy the equation

Geometric transformations assign a point to a point, so it is a point valued function of points. Geometric transformation may destroy the equation Geometric transformations assign a point to a point, so it is a point valued function of points. Geometric transformation may destroy the equation and the type of an object. Even simple scaling turns a

More information

Reading. Hierarchical Modeling. Symbols and instances. Required: Angel, sections , 9.8. Optional:

Reading. 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 information

Introduction to Computer Graphics with WebGL

Introduction 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 information

Graphics and Visualization

Graphics 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 information

Modeling Transform. Chapter 4 Geometric Transformations. Overview. Instancing. Specify transformation for objects 李同益

Modeling 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 information

Rendering Pipeline and Coordinates Transforms

Rendering Pipeline and Coordinates Transforms Rendering Pipeline and Coordinates Transforms Alessandro Martinelli alessandro.martinelli@unipv.it 16 October 2013 Rendering Pipeline (3): Coordinates Transforms Rendering Architecture First Rendering

More information

Transformations. Questions on Assignment 1? Announcements

Transformations. Questions on Assignment 1? Announcements Announcements Is your account working yet? Watch out for ^M and missing newlines Assignment 1 is due next Thursday at midnight Check the webpage and newsgroup for answers to questions about the assignment

More information

CS 130 Final. Fall 2015

CS 130 Final. Fall 2015 CS 130 Final Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying

More information

EECE 478. Learning Objectives. Learning Objectives. Linear Algebra and 3D Geometry. Linear algebra in 3D. Coordinate systems

EECE 478. Learning Objectives. Learning Objectives. Linear Algebra and 3D Geometry. Linear algebra in 3D. Coordinate systems EECE 478 Linear Algebra and 3D Geometry Learning Objectives Linear algebra in 3D Define scalars, points, vectors, lines, planes Manipulate to test geometric properties Coordinate systems Use homogeneous

More information

Introduction to Computer Graphics 4. Viewing in 3D

Introduction to Computer Graphics 4. Viewing in 3D Introduction to Computer Graphics 4. Viewing in 3D National Chiao Tung Univ, Taiwan By: I-Chen Lin, Assistant Professor Textbook: E.Angel, Interactive Computer Graphics, 5 th Ed., Addison Wesley Ref: Hearn

More information

3D Viewing. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 9

3D Viewing. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 9 3D Viewing CS 46 Lecture 9 Cornell CS46 Spring 18 Lecture 9 18 Steve Marschner 1 Viewing, backward and forward So far have used the backward approach to viewing start from pixel ask what part of scene

More information

COMP 175 COMPUTER GRAPHICS. Lecture 07: Scene Graph. COMP 175: Computer Graphics March 10, Remco Chang 07 Scene Graph

COMP 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

Transformations. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Transformations. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Angel: Interactive Computer Graphics 4E Addison-Wesley 25 1 Objectives

More information

Rotations (and other transformations) Rotation as rotation matrix. Storage. Apply to vector matrix vector multiply (15 flops)

Rotations (and other transformations) Rotation as rotation matrix. Storage. Apply to vector matrix vector multiply (15 flops) Cornell University CS 569: Interactive Computer Graphics Rotations (and other transformations) Lecture 4 2008 Steve Marschner 1 Rotation as rotation matrix 9 floats orthogonal and unit length columns and

More information

Computer Graphics: Geometric Transformations

Computer Graphics: Geometric Transformations Computer Graphics: Geometric Transformations Geometric 2D transformations By: A. H. Abdul Hafez Abdul.hafez@hku.edu.tr, 1 Outlines 1. Basic 2D transformations 2. Matrix Representation of 2D transformations

More information

Chap 3 Viewing Pipeline Reading: Angel s Interactive Computer Graphics, Sixth ed. Sections 4.1~4.7

Chap 3 Viewing Pipeline Reading: Angel s Interactive Computer Graphics, Sixth ed. Sections 4.1~4.7 Chap 3 Viewing Pipeline Reading: Angel s Interactive Computer Graphics, Sixth ed. Sections 4.~4.7 Chap 3 View Pipeline, Comp. Graphics (U) CGGM Lab., CS Dept., NCTU Jung Hong Chuang Outline View parameters

More information

Transformations IV. Week 3, Wed Jan 20

Transformations IV. Week 3, Wed Jan 20 University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Transformations IV Week 3, Wed Jan 20 http://www.ugrad.cs.ubc.ca/~cs314/vjan2010 Assignments 2 Correction: Assignments

More information

Computer Graphics. Chapter 10 Three-Dimensional Viewing

Computer 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 information

Three-Dimensional Graphics III. Guoying Zhao 1 / 67

Three-Dimensional Graphics III. Guoying Zhao 1 / 67 Computer Graphics Three-Dimensional Graphics III Guoying Zhao 1 / 67 Classical Viewing Guoying Zhao 2 / 67 Objectives Introduce the classical views Compare and contrast image formation by computer with

More information

3D Transformations World Window to Viewport Transformation Week 2, Lecture 4

3D Transformations World Window to Viewport Transformation Week 2, Lecture 4 CS 430/536 Computer Graphics I 3D Transformations World Window to Viewport Transformation Week 2, Lecture 4 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing Laboratory

More information

COMP3421. Vector geometry, Clipping

COMP3421. Vector geometry, Clipping COMP3421 Vector geometry, Clipping Transformations Object in model co-ordinates Transform into world co-ordinates Represent points in object as 1D Matrices Multiply by matrices to transform them Coordinate

More information

Using GLU/GLUT Objects

Using GLU/GLUT Objects Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutwirecone glutwirecube glucylinder glutwireteapot GLU/GLUT Objects Each glu/glut object has its default size, position, and orientation

More information

Lecture 5: Transforms II. Computer Graphics and Imaging UC Berkeley CS184/284A

Lecture 5: Transforms II. Computer Graphics and Imaging UC Berkeley CS184/284A Lecture 5: Transforms II Computer Graphics and Imaging UC Berkeley 3D Transforms 3D Transformations Use homogeneous coordinates again: 3D point = (x, y, z, 1) T 3D vector = (x, y, z, 0) T Use 4 4 matrices

More information

(Refer Slide Time: 00:04:20)

(Refer Slide Time: 00:04:20) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 8 Three Dimensional Graphics Welcome back all of you to the lectures in Computer

More information