CSE 167: Introduction to Computer Graphics Lecture #2: Coordinate Transformations

Similar documents
Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

CSE 167: Introduction to Computer Graphics Lecture #4: Coordinate Systems

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

Vector Algebra Transformations. Lecture 4

CT5510: Computer Graphics. Transformation BOCHANG MOON

CSE 167: Introduction to Computer Graphics Lecture #3: Coordinate Systems

CSE 167: Introduction to Computer Graphics Lecture #3: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

CSE 167: Introduction to Computer Graphics Lecture #3: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

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

2D/3D Geometric Transformations and Scene Graphs

Transforms. COMP 575/770 Spring 2013

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

Graphics and Interaction Transformation geometry and homogeneous coordinates

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

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

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

Geometric Transformations

COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective

Linear transformations Affine transformations Transformations in 3D. Graphics 2009/2010, period 1. Lecture 5: linear and affine transformations

Computer Graphics Geometric Transformations

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

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

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

GEOMETRIC TRANSFORMATIONS AND VIEWING

Computer Graphics with OpenGL ES (J. Han) Chapter IV Spaces and Transforms

CALCULATING TRANSFORMATIONS OF KINEMATIC CHAINS USING HOMOGENEOUS COORDINATES

CSE 167: Introduction to Computer Graphics Lecture #11: Visibility Culling

Lecture 9: Transformations. CITS3003 Graphics & Animation

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

CS354 Computer Graphics Rotations and Quaternions

Game Engineering: 2D

Game Engineering CS S-05 Linear Transforms

Coordinate Frames and Transforms

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

Vector Calculus: Understanding the Cross Product

3D Mathematics. Co-ordinate systems, 3D primitives and affine transformations

CSE 167: Introduction to Computer Graphics Lecture #9: Visibility. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018

2D and 3D Transformations AUI Course Denbigh Starkey

Orientation & Quaternions

Affine Transformation. Edith Law & Mike Terry

CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Image warping , , Computational Photography Fall 2017, Lecture 10

Homework 5: Transformations in geometry

2D transformations: An introduction to the maths behind computer graphics

Exercise Max. Points Total 90

UNIT 2 2D TRANSFORMATIONS

18.02 Multivariable Calculus Fall 2007

CS184: Using Quaternions to Represent Rotation

3D Geometry and Camera Calibration

Transformations: 2D Transforms

Computer Science 336 Fall 2017 Homework 2

Animation. Keyframe animation. CS4620/5620: Lecture 30. Rigid motion: the simplest deformation. Controlling shape for animation

What You ll See in This Chapter. Word Cloud. Definitions. Matrix Components. Ian Parberry University of North Texas. Fletcher Dunn

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

To Do. Outline. Translation. Homogeneous Coordinates. Foundations of Computer Graphics. Representation of Points (4-Vectors) Start doing HW 1

Camera Model and Calibration

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

+ i a y )( cosφ + isinφ) ( ) + i( a x. cosφ a y. = a x

CV: 3D sensing and calibration

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

Exercise Max. Points Total 80

CS F-07 Objects in 2D 1

Revision Problems for Examination 2 in Algebra 1

Basic Elements. Geometry is the study of the relationships among objects in an n-dimensional space

2D Image Transforms Computer Vision (Kris Kitani) Carnegie Mellon University

CS770/870 Spring 2017 Transformations

2D and 3D Coordinate Systems and Transformations

Transformations. CSCI 420 Computer Graphics Lecture 4

Answers. Chapter 2. 1) Give the coordinates of the following points:

Lecture 4: Transforms. Computer Graphics CMU /15-662, Fall 2016

INTRODUCTION TO COMPUTER GRAPHICS. It looks like a matrix Sort of. Viewing III. Projection in Practice. Bin Sheng 10/11/ / 52

Section 13.5: Equations of Lines and Planes. 1 Objectives. 2 Assignments. 3 Lecture Notes

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

Computer Graphics. P04 Transformations. Aleksandra Pizurica Ghent University

Motivation. General Idea. Goals. (Nonuniform) Scale. Outline. Foundations of Computer Graphics. s x Scale(s x. ,s y. 0 s y. 0 0 s z.

Overview. By end of the week:

Lecture 5 2D Transformation

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

Affine Transformations Computer Graphics Scott D. Anderson

MTRX4700 Experimental Robotics

To do this the end effector of the robot must be correctly positioned relative to the work piece.

Vector Addition. Qty Item Part Number 1 Force Table ME-9447B 1 Mass and Hanger Set ME Carpenter s level 1 String

Adding vectors. Let s consider some vectors to be added.

Game Engineering CS S-07 Homogenous Space and 4x4 Matrices

CMSC 425: Lecture 6 Affine Transformations and Rotations

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

Quaternion Rotations AUI Course Denbigh Starkey

Graphics Pipeline 2D Geometric Transformations

CS 6958 LECTURE 4 INTRO TO GRAPHICS GEOMETRY

Coordinate transformations. 5554: Packet 8 1

Transformation. Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering

Short on camera geometry and camera calibration

3D 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);

INTRODUCTION TO COMPUTER GRAPHICS. cs123. It looks like a matrix Sort of. Viewing III. Projection in Practice 1 / 52

0_PreCNotes17 18.notebook May 16, Chapter 12

Transformations Week 9, Lecture 18

Specifying Complex Scenes

Linear and Affine Transformations Coordinate Systems

Graphics. Vector and Matrix Algebra. Korea Univ. Computer Graphics Lab. Graphics Korea University.

Transcription:

CSE 167: Introduction to Computer Graphics Lecture #2: Coordinate Transformations Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

Announcements Homework #1 due Friday Oct 4 th at 1:30pm; presentation in CS basement lab 260 Tip: Don t save anything on the C: drive of the lab PCs in Windows. You will lose it when you log out! 2

Lecture Overview Vectors and Matrices Linear Transformations Homogeneous Coordinates Affine Transformations 3

Vectors Direction and length in 3D Vectors can describe Difference between two 3D points Speed of an object Surface normals (directions perpendicular to surfaces) Normal vector 4 Surface normals Surface

Vector arithmetic using coordinates a = ax ay az b = bx by bz a + b = ax + bx ay + by az + bz a b = ax bx ay by az bz ax a= ay az sax sa= say saz where s is a scalar 5

Vector Magnitude The magnitude (length) of a vector is: v 2 = v x 2 + v y 2 + v z 2 v = v x 2 + v y 2 + v z 2 A vector with length of 1.0 is called unit vector We can also normalize a vector to make it a unit vector Unit vectors are often used as surface normals v v 6

Dot Product a b = a i b i a b = a x b x + a y b y + a z b z a b = a b cosθ 7

Angle Between Two Vectors a b = a b cosθ cosθ = a b a b b θ = cos 1 a b a b a 8

Cross Product a b is a vector perpendicular to both a and b, in the direction defined by the right hand rule a b = a b sinθ a b = area of parallelogram ab a b = 0 if a and b are parallel (or one or both degenerate) 9

Cross product 10

Sample Vector Class in C++ class Vector3 { public: float x,y,z; Vector3() Vector3(float x0,float y0,float z0) void set(float x0,float y0,float z0) void add(vector3 &a) void add(vector3 &a,vector3 &b) void subtract(vector3 &a) void subtract(vector3 &a,vector3 &b) void negate() void negate(vector3 &a) void scale(float s) void scale(float s,vector3 &a) float dot(vector3 &a) void cross(vector3 &a,vector3 &b) float magnitude() void normalize() }; {x=0.0; y=0.0; z=0.0;} {x=x0; y=y0; z=z0;} {x=x0; y=y0; z=z0;} {x+=a.x; y+=a.y; z+=a.z;} {x=a.x+b.x; y=a.y+b.y; z=a.z+b.z;} {x-=a.x; y-=a.y; z-=a.z;} {x=a.x-b.x; y=a.y-b.y; z=a.z-b.z;} {x=-x; y=-y; z=-z;} {x=-a.x; y=-a.y; z=-a.z;} {x*=s; y*=s; z*=s;} {x=s*a.x; y=s*a.y; z=s*a.z;} {return x*a.x+y*a.y+z*a.z;} {x=a.y*b.z-a.z*b.y; y=a.z*b.x-a.x*b.z; z=a.x*b.y-a.y*b.x;} {return sqrt(x*x+y*y+z*z);} {scale(1.0/magnitude());} 11

Matrices Rectangular array of numbers Square matrix if m = n In graphics often m = n = 3; m = n = 4 12

Matrix Addition 13

Multiplication With Scalar 14

Matrix Multiplication 15

Matrix-Vector Multiplication 16

Identity Matrix 17

Matrix Inverse If a square matrix M is non-singular, there exists a unique inverse M -1 such that 18

OpenGL Matrices Vectors are column vectors Column major ordering Matrix elements stored in array of floats float M[16]; Corresponding matrix elements: 19

Lecture Overview Vectors and Matrices Linear Transformations Homogeneous Coordinates Affine Transformations 20

Linear Transformations Scaling, shearing, rotation, reflection of vectors, and combinations thereof Implemented using matrix multiplications 21

Scaling Uniform scaling matrix in 2D Analogous in 3D 22

Scaling Nonuniform scaling matrix in 2D Analogous in 3D 23

Shearing Shearing along x-axis in 2D Analogous for y-axis, in 3D 24

Rotation in 2D Convention: positive angle rotates counterclockwise Rotation matrix 25

Rotation in 3D Rotation around coordinate axes 26

Rotation in 3D Concatenation of rotations around x, y, z axes are called Euler angles Result depends on matrix order! 27

Rotation in 3D Around arbitrary axis R(a,θ) = 1+ (1 cos(θ))(a 2 x 1) a z sin(θ) + (1 cos(θ))a x a y a y sin(θ) + (1 cos(θ))a x a z a z sin(θ) + (1 cos(θ))a y a x 1+ (1 cos(θ))(a 2 y 1) a x sin(θ) + (1 cos(θ))a y a z a y sin(θ) + (1 cos(θ))a z a x a x sin(θ) + (1 cos(θ))a z a y 1+ (1 cos(θ))(a 2 z 1) Rotation axis a a must be a unit vector: Right-hand rule applies for direction of rotation Counterclockwise rotation a = 1 28

Lecture Overview Vectors and Matrices Linear Transformations Homogeneous Coordinates Affine Transformations 29

Homogeneous Coordinates We add a 4 th coordinate to vectors and points. Usually for 3D points we choose. For 3D vectors. Benefit of homogeneous coordinates: vectors and points both represented by 4 coordinates 30

Homogeneous Coordinates Generalized homogeneous point: Obtain 3D coordinates of point: divide by homogeneous coordinate 31

Translation Example for homogeneous coordinates: 32

Translation Matrix notation 33 Translation matrix

Transformations Add 4 th row/column to 3 x 3 transformation matrices Example: rotation 34

Transformations Concatenation of transformations: Arbitrary transformations (scale, shear, rotation, translation) Build chains of transformations Result depends on order 35

Lecture Overview Vectors and Matrices Linear Transformations Homogeneous Coordinates Affine Transformations 36

Affine transformations Generalization of linear transformations Scale, shear, rotation, reflection (linear) Translation Preserve straight lines, parallel lines Implementation using 4x4 matrices and homogeneous coordinates 37

Translation 38

Translation Inverse translation 39

Scaling Origin does not change 40

Scaling Inverse of scale: 41

Shear Pure shear if only one parameter is non-zero 42

Rotation around coordinate axis Origin does not change 43

Rotation around arbitrary axis Origin does not change Angle, unit axis a 44

Rotation matrices Orthonormal Rows, columns are unit length and orthogonal Inverse of rotation matrix: Its transpose 45

Videos Linear Algebra - Affine Matrix Transformations With Shapes (0:00-5:00) Part of http://computersciencevideos.org/cplusplus-linear- Algebra/ http://www.youtube.com/watch?v=4inr_27dm4u Online Graphics Basic Math: Matrices http://www.youtube.com/watch?v=rkx2u16qyy8 46