Transforms. COMP 575/770 Spring 2013

Similar documents
Vector Algebra Transformations. Lecture 4

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

Geometric Transformations

2D/3D Geometric Transformations and Scene Graphs

Linear and Affine Transformations Coordinate Systems

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

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

CT5510: Computer Graphics. Transformation BOCHANG MOON

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

Lecture 5 2D Transformation

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

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

3D Geometry and Camera Calibration

Graphics and Interaction Transformation geometry and homogeneous coordinates

2D Object Definition (1/3)

Interactive Computer Graphics. Hearn & Baker, chapter D transforms Hearn & Baker, chapter 5. Aliasing and Anti-Aliasing

GEOMETRIC TRANSFORMATIONS AND VIEWING

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

COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective

Computer Graphics Geometric Transformations

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

COMP3421. Vector geometry, Clipping

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

Graphics Pipeline 2D Geometric Transformations

Computer Graphics: Geometric Transformations

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

UNIT 2 2D TRANSFORMATIONS

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

2D and 3D Transformations AUI Course Denbigh Starkey

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

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

Overview. By end of the week:

Transformations Week 9, Lecture 18

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

CS559: Computer Graphics

CMSC 425: Lecture 6 Affine Transformations and Rotations

3-D D Euclidean Space - Vectors

Affine Transformations in 3D

Coordinate transformations. 5554: Packet 8 1

Computer Graphics Hands-on

Rigid Body Motion and Image Formation. Jana Kosecka, CS 482

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics I. Guoying Zhao 1 / 52

2D Transformations Introduction to Computer Graphics Arizona State University

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

Overview. Affine Transformations (2D and 3D) Coordinate System Transformations Vectors Rays and Intersections

Coordinate Transformations & Homogeneous Coordinates

CALCULATING TRANSFORMATIONS OF KINEMATIC CHAINS USING HOMOGENEOUS COORDINATES

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

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

Specifying Complex Scenes

Transformations. Questions on Assignment 1? Announcements

3D Viewing Episode 2

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

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

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

CV: 3D sensing and calibration

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

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

Game Engineering CS S-05 Linear Transforms

521493S Computer Graphics Exercise 2 Solution (Chapters 4-5)

3D Viewing Episode 2

Advanced Computer Graphics Transformations. Matthias Teschner

Transforms 1 Christian Miller CS Fall 2011

Answers to practice questions for Midterm 1

Camera Model and Calibration

Affine Transformation. Edith Law & Mike Terry

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

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CS770/870 Spring 2017 Transformations

Mathematics 308 Geometry. Chapter 9. Drawing three dimensional objects

Homogeneous Coordinates

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

Camera Calibration. COS 429 Princeton University

Section III: TRANSFORMATIONS

Chapter 2 - Basic Mathematics for 3D Computer Graphics

COMP3421. Introduction to 3D Graphics

Coordinate Frames and Transforms

Transformations. Examples of transformations: shear. scaling

Today s Topics. 3. Transformations in 2D. 4. Coordinate-free geometry. 5. 3D Objects (curves & surfaces) 6. Transformations in 3D

3D Geometry and Camera Calibration

XPM 2D Transformations Week 2, Lecture 3

COMP 175 COMPUTER GRAPHICS. Ray Casting. COMP 175: Computer Graphics April 26, Erik Anderson 09 Ray Casting

Monday, 12 November 12. Matrices

Midterm Exam Solutions

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation

Basics of Computational Geometry

CSE328 Fundamentals of Computer Graphics

Introduction to Homogeneous coordinates

Image warping , , Computational Photography Fall 2017, Lecture 10

2D and 3D Coordinate Systems and Transformations

Computer Science 336 Fall 2017 Homework 2

Transformation. Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering

CS452/552; EE465/505. Geometry Transformations

XPM 2D Transformations Week 2, Lecture 3

Robot mechanics and kinematics

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

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

MET71 COMPUTER AIDED DESIGN

Chapter 3 - Basic Mathematics for 3D Computer Graphics

CS 130 Final. Fall 2015

Transcription:

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 can move, rotate, resize, deform, etc.

Translation Simplest transformation: T v = v + v 0 Inverse transform: T 1 v = v v 0

Linear Transforms Suppose we want a transform like: x = ax + by y = cx + dy Can express as a matrix-vector multiplication: x y = a b c d x y Called linear because T αu + βv = αt u + βt v

Linear Transforms We write column vectors, so matrices multiply on the left: x y = a b c d x y Some people write row vectors, where matrices multiply on the right (and are transposed): x y = x y a c b d

Linear Transforms Many kinds of transforms are linear Uniform scaling Non-uniform scaling Rotation Reflection Shearing We just need to know the matrices

Outline Transforms Gallery of Transforms

Uniform Scaling Make an object bigger or smaller Matrix form: M scale = s 0 0 s x = sx y = sy 1 M scale = 1 s 0 0 1 s

Non-Uniform Scaling Stretch an object along different directions Matrix form: x = s x x y = s y y M scale = s x 0 1 0 s M scale = y 1 s x 0 0 1 s y

Rotation y y r x Θ r = xi + yj r = x u + y v u = cos θi + sin θj v = sin θi + cos θj x

Rotation Rotate an object, pivoting around the origin Matrix form: x = x cos θ y sin θ y = x sin θ + y cos θ M rotate = cos θ sin θ sin θ cos θ 1 M rotate = cos θ sin θ sin θ cos θ

Reflection Reflect an object across a coordinate axis Matrix form: M reflect = 1 0 0 1 x = x y = y M reflect 1 = 1 0 0 1

Shearing Stretch and deform an object in a particular way Matrix form: M shear = 1 a 0 1 x = x + ay y = y M shear 1 = 1 a 0 1

Outline Transforms Gallery of Transforms Composing Transforms

Composing Transforms Suppose we apply two successive transforms: p T p S T p = S T p Need to represent S T In the same way as S and T

Composing Translations Suppose we translate by u T then by u S : T p = p + u T S p = p + u S S T p = p + (u T + u S ) Equivalent to translation by u T + u S Commutative!

Composing Linear Transforms Suppose we apply M T followed by M S : T p = M T p S p = M S p S T p = M S M T p Equivalent to applying M S M T Not always commutative!

Composing Linear Transforms scale, then rotate rotate, then scale

Outline Transforms Gallery of Transforms Composing Transforms Affine Transforms

Homogeneous Coordinates How to compose linear transforms and translation? With a unified representation Our equations are of this form: x = ax + by + c y = dx + ey + f Matrix-vector form: x y 1 = a b c d e f 0 0 1 x y 1 Homogeneous coordinates (extra w coordinate)

Affine Transforms Transform in homogeneous coordinates which preserves w Last row of matrix is always 0 0 1 Properties: Straight lines remain straight lines Parallel lines remain parallel Length ratios preserved (midpoints remain midpoints)

Translation

Uniform Scaling

Non-Uniform Scaling

Rotation

Reflection

Shearing

Composing Affine Transforms Analogous to composing linear transforms M T followed by M S equivalent to M S M T Not commutative!

Composing Affine Transforms rotate, then translate translate, then rotate

Rigid-Body Transforms Special case of affine transform Contains only rotation and translation: R = Q u 0 1 Since inverse of orthonormal matrix is its transpose: R 1 = Qt Q t u 0 1

Composite Transforms Want to rotate about a specific point We know how to rotate about the origin And how to translate to the origin

Composite Transforms Want to scale along a specific axis, about a point We know how to scale along y at the origin And how to rotate about / translate to the origin

Transforming Points vs. Vectors Distinction between points and vectors Points are locations Vectors are differences between points Respond differently to transformation Vectors cannot be translated, points can v = p q T x = Mx + t T v = T p q = Mp + t Mq + t = M p q + t t = Mv

Transforming Points vs. Vectors Homogeneous coordinates handle this neatly Just set w = 0 for vectors: v = v x v y 0 Subtracting two points gives a vector: p x p y 1 q x q y 1 = p x q x p y q y 0

Outline Transforms Gallery of Transforms Composing Transforms Affine Transforms Coordinate Frames

Coordinate Frames Want to describe points in an arbitrary frame In terms of canonical coordinates r r Mapping from (r x, r y ) to r u, r v using a matrix Define coordinates as follows: r = p + r u u + r v v

Matrix Multiplication Two interpretations Dot products with each row: x y w = a x a y a w b x b y b w c x c y c w x y w = a r b r c r Weighted sum of columns: x y w = a x a y a w b x b y b w c x c y c w x y w = x a x b x c x + y a y b y c y + z a z b z c z

Coordinate Frames Definition of coordinate frames: r = p + r u u + r v v Frame-to-canonical matrix: u v p 0 0 1 Transforms from given frame to canonical frame Canonical-to-frame is just the inverse

Similarity Transform How to apply transform defined wrt arbitrary frame For example, scale by a factor of 2 along (1,2) Composition using frame-to-canonical matrix: T e = FT F F 1 T e is the transform wrt canonical frame T F is the transform wrt given frame F is the frame-to-canonical matrix This is a similarity transform

Outline Transforms Gallery of Transforms Composing Transforms Affine Transforms 3D Transforms

3D Affine Transforms Straightforward extension of the 2D case Results in 4 4 matrices Rotation is a little trickier though

Translation

Scaling

Rotation About z Axis

Rotation About x Axis

Rotation About y Axis

General Rotations A rotation in 2D is around a point A rotation in 3D is around an axis Many more 3D rotations than 2D 2D 3D

Specifying Rotations Need to specify and axis and an angle Convention: Positive θ is CCW when axis points at you Alternative: Euler angles Sequence of 3 rotations, about coordinate axes

Axis-Angle Rotations Essentially a similarity transform Canonical-to-frame transform: Translate axis to pass through origin Rotate about y to get axis into x-y plane Rotate about z to align axis with x axis

Axis-Angle Rotations Alternative: Construct a coordinate frame Let {p, u, v, w} be a coordinate frame with p lying on the axis u along the axis Apply a similarity transform T = FR x F 1

Creating Orthonormal Frames How to create an orthonormal frame {u, v, w} given 1 or 2 vectors? Multiple applications Axis-angle rotation Moving a camera around Surface shading and more

Creating Orthonormal Frames Given vector a and secondary vector b Need u to be parallel to a, and b to lie in uv plane u = a a w = u b u b v = w u

Creating Orthonormal Frames Given a single vector a Need u to be parallel to a Pick an arbitrary b, then use the same process Need to make sure b isn t accidentally parallel to a Rule of thumb: b = a, with smallest entry set to 1

Axis-Angle Rotations Putting it all together: 1. Given axis a, use rule of thumb to determine b 2. Using a and b, construct orthonormal frame {p, u, v, w} 3. Construct frame-to-canonical matrix from for {p, u, v, w} 4. Apply similarity transform Rotate along x axis in the {p, u, v, w} frame

Outline Transforms Gallery of Transforms Composing Transforms Affine Transforms 3D Transforms Transforms and Surface Normals

Transforming Normal Vectors Suppose we apply a transform T to a surface Will the normals transform correctly under T? i.e., will they remain perpendicular to the surface? T We need a (slightly) different transform, say X

Transforming Normal Vectors Normal is perpendicular to surface tangent t Should continue to be so, after transformation: So we use: t n = t t n = 0 Mt Xn = t t M t Xn = 0 X = Mt 1 Mt Xn = t t M t M t 1 n = t t n = 0

The End But W will return in The Perspective Projection Matrix