Lecture 8: Coordinate Frames. CITS3003 Graphics & Animation

Similar documents
CSE4030 Introduction to Computer Graphics

Linear Independence. , v 2. is linearly independent if. =0 iff 1

CG Basics 1 of 10. Mathematical Foundations: Vectors, Matrices, & Parametric Equations

Affine transformations

Reading. Affine transformations. Vector representation. Geometric transformations. x y z. x y. Required: Angel 4.1, Further reading:

Section 1.5. Solution Sets of Linear Systems

The Affine Group of Transformations

CSC 470 Introduction to Computer Graphics. Mathematical Foundations Part 2

Affine transformations

Affine transformations

Affine transformations. Brian Curless CSE 557 Fall 2014

Linear Algebra & Geometry why is linear algebra useful in computer vision?

CSE 167: Introduction to Computer Graphics Lecture #2: Linear Algebra Primer

COMP 175 COMPUTER GRAPHICS. Lecture 04: Transform 1. COMP 175: Computer Graphics February 9, Erik Anderson 04 Transform 1

2018 Fall 2210Q Section 013 Midterm Exam I Solution

Lecture 5 3D polygonal modeling Part 1: Vector graphics Yong-Jin Liu.

Introduction. Introduction (2) Easy Problems for Vectors 7/13/2011. Chapter 4. Vector Tools for Graphics

CSE 167: Introduction to Computer Graphics Lecture #2: Linear Algebra Primer

7.6 The Inverse of a Square Matrix

Linear Algebra & Geometry why is linear algebra useful in computer vision?

Math 3191 Applied Linear Algebra

3D SOLAR SYSTEM VISUALIZATION WITH OpenGL

Intro Vectors 2D implicit curves 2D parametric curves. Graphics 2011/2012, 4th quarter. Lecture 2: vectors, curves, and surfaces

Announcements Monday, September 18

1. Let m 1 and n 1 be two natural numbers such that m > n. Which of the following is/are true?

A geometric interpretation of the homogeneous coordinates is given in the following Figure.

Multi-Frame Factorization Techniques

03 - Basic Linear Algebra and 2D Transformations

Vector and Affine Math

Homogeneous Coordinates

Camera Models and Affine Multiple Views Geometry

Intro Vectors 2D implicit curves 2D parametric curves. Graphics 2012/2013, 4th quarter. Lecture 2: vectors, curves, and surfaces

I&C 6N. Computational Linear Algebra

Transformations. Chapter D Transformations Translation

CS 4300 Computer Graphics. Prof. Harriet Fell Fall 2011 Lecture 11 September 29, 2011

Geometric Image Manipulation

Multiple View Geometry in Computer Vision

Reading. 4. Affine transformations. Required: Watt, Section 1.1. Further reading:

Linear Algebra Review Part I: Geometry

Slope Fields and Differential Equations. Copyright Cengage Learning. All rights reserved.

Structural Dynamics Lecture 4. Outline of Lecture 4. Multi-Degree-of-Freedom Systems. Formulation of Equations of Motions. Undamped Eigenvibrations.

Mathematical Fundamentals

Quintic beam closed form matrices (revised 2/21, 2/23/12) General elastic beam with an elastic foundation

Linear Algebra V = T = ( 4 3 ).

LS.1 Review of Linear Algebra

Homogeneous Transformations

Section 2.2: The Inverse of a Matrix

Linear Algebra. Min Yan

Chapter 8. Rigid transformations

The set of all solutions to the homogeneous equation Ax = 0 is a subspace of R n if A is m n.

CS 112 Transformations II. Aditi Majumder, CS 112 Slide 1

Math 220: Summer Midterm 1 Questions

Vectors Coordinate frames 2D implicit curves 2D parametric curves. Graphics 2008/2009, period 1. Lecture 2: vectors, curves, and surfaces

EE Camera & Image Formation

Linear Algebra. The analysis of many models in the social sciences reduces to the study of systems of equations.

AFFINE COMBINATIONS, BARYCENTRIC COORDINATES, AND CONVEX COMBINATIONS

Matrix-Vector Products and the Matrix Equation Ax = b

MCE/EEC 647/747: Robot Dynamics and Control. Lecture 2: Rigid Motions and Homogeneous Transformations

General elastic beam with an elastic foundation

Review Let A, B, and C be matrices of the same size, and let r and s be scalars. Then

Lecture 02: 2D Geometry. August 24, 2017

MAC Learning Objectives. Learning Objectives (Cont.) Module 10 System of Equations and Inequalities II

2. Preliminaries. x 2 + y 2 + z 2 = a 2 ( 1 )

Vectors and Matrices

Math 3191 Applied Linear Algebra

ANALYTICAL MATHEMATICS FOR APPLICATIONS 2018 LECTURE NOTES 3

Linear Algebra Exam 1 Spring 2007

6.837 LECTURE 8. Lecture 8 Outline Fall '01. Lecture Fall '01

Determinant: 3.3 Properties of Determinants

Basic Linear Algebra. Florida State University. Acknowledgements: Daniele Panozzo. CAP Computer Graphics - Fall 18 Xifeng Gao

Linear Algebra (wi1403lr) Lecture no.4

Robotics & Automation. Lecture 06. Serial Kinematic Chain, Forward Kinematics. John T. Wen. September 11, 2008

4. Matrix inverses. left and right inverse. linear independence. nonsingular matrices. matrices with linearly independent columns

1 Overview. CS348a: Computer Graphics Handout #8 Geometric Modeling Original Handout #8 Stanford University Thursday, 15 October 1992

CS 378: Computer Game Technology

Minimal representations of orientation

Linear Algebra. Preliminary Lecture Notes

Ridig Body Motion Homogeneous Transformations

Linear transformations

Lecture 10: Determinants and Cramer s Rule

Matrix Algebra. Learning Objectives. Size of Matrix

FREE VIBRATION RESPONSE OF UNDAMPED SYSTEMS

Lecture 7: Introduction to linear systems

Finite Element Analysis Prof. Dr. B. N. Rao Department of Civil Engineering Indian Institute of Technology, Madras. Lecture - 06

Linear Algebra. Preliminary Lecture Notes

2D Geometric Transformations. (Chapter 5 in FVD)

Segmentation of Dynamic Scenes from the Multibody Fundamental Matrix

We use the overhead arrow to denote a column vector, i.e., a number with a direction. For example, in three-space, we write

Mathematics for 3D Graphics

Pose estimation from point and line correspondences

What is the Matrix? Linear control of finite-dimensional spaces. November 28, 2010

Three-Dimensional Coordinate Systems. Three-Dimensional Coordinate Systems. Three-Dimensional Coordinate Systems. Three-Dimensional Coordinate Systems

Rigid Body Transforms-3D. J.C. Dill transforms3d 27Jan99

Lecture 22: Section 4.7

Examples: u = is a vector in 2. is a vector in 5.

Matrix Calculations: Linear maps, bases, and matrices

Linear and affine transformations

Position and orientation of rigid bodies

Elements of Continuum Elasticity. David M. Parks Mechanics and Materials II February 25, 2004

Contents. 1 Vectors, Lines and Planes 1. 2 Gaussian Elimination Matrices Vector Spaces and Subspaces 124

Transcription:

Lecture 8: Coordinate Frames CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

Objectives Learn how to define and change coordinate frames Introduce standard transformations Rotation, Translation, Scaling, Shear Derive homogeneous coordinate transformation matrices Learn to build arbitrary transformation matrices from simple transformations 2

Coordinate Frame Basis vectors alone cannot represent a points We can add a single point, the origin, to the basis vectors to form a coordinate frame Recall the affine space v 2 P 0 v 1 v 3 3

Representation in a Coordinate Frame A coordinate system (or coordinate frame) is determined by P 0, v 1, v 2, v 3 Within this coordinate frame, every vector v can be written as v = α 1 v 1 + α 2 v 2 + α 3 v 3 Every point can be written as P = P 0 + β 1 v 1 + β 2 v 2 + β 3 v 3 for some α 1, α 2, α 3, and β 1, β 2, β 3 4

Homogeneous Coordinates Consider the point P and the vector v, where P = P 0 + β 1 v 1 + β 2 v 2 + β 3 v 3 v = α 1 v 1 + α 2 v 2 + α 3 v 3 They appear to have similar representations: P = [β 1, β 2, β 3 ] T, v =[α 1, α 2, α 3 ] T which confuses the point with the vector A vector has no position v v p Vector can be placed anywhere point: fixed 5

A Single Representation Since 0 P = 0 and 1 P = P then we can write v = α 1 v 1 + α 2 v 2 + α 3 v 3 = α 1 v 1 + α 2 v 2 + α 3 v 3 + 0 P 0 P = β 1 v 1 + β 2 v 2 + β 3 v 3 + P 0 = β 1 v 1 + β 2 v 2 + β 3 v 3 + 1 P 0 Thus we obtain the four-dimensional homogeneous coordinate representation v = α 1 α 2 α 3 0 T v = 0 P = β 1 β 2 β 3 1 T v 6

Homogeneous Coordinates The homogeneous coordinate form for a three dimensional point x y z T is given as p = x y z 1 T = wx wy wz w T = x y z w T We return to a three dimensional point (for w 0) by x x /w y y /w z z /w If w = 0, the representation is that of a vector Note that homogeneous coordinates replace points in three dimensions by lines through the origin in four dimensions For w = 1, the representation of a point is x y z 1 T 7

Homogeneous Coordinates and Computer Graphics Homogeneous coordinates are key to all computer graphics systems All standard transformations (rotation, translation, scaling) can be implemented with matrix multiplications using 4 x 4 matrices Hardware pipeline works with 4 dimensional representations For orthographic viewing, we can maintain w = 0 for vectors and w = 1 for points For perspective we need a perspective division 8

Representing the Second Basis in Terms of the First How can we relate a with b? Each of the basis vectors u 1, u 2, and u 3 are vectors that can be represented in terms of the first set of basis vectors, i.e., u 1 = γ 11 v 1 + γ 12 v 2 +γ 13 v 3 u 2 = γ 21 v 1 + γ 22 v 2 +γ 23 v 3 u 3 = γ 31 v 1 + γ 32 v 2 +γ 33 v 3 v for some γ 11,, γ 33 9

Representing the Second Basis in Terms of the First (cont.) u 1 = γ 11 v 1 + γ 12 v 2 +γ 13 v 3 can be written as: γ 11 γ 11 u 1 = v 1 v 2 v 3 γ 12 = V γ 12 γ 13 γ 13 Similarly, u 2 = γ 21 v 1 + γ 22 v 2 +γ 23 v 3 and u 3 = γ 31 v 1 + γ 32 v 2 +γ 33 v 3 can be written as: u 2 = V u 3 = V γ 21 γ 22 γ 23 γ 31 γ 32 γ 33 10

Representing the Second Basis in Terms of the First (cont.) We can put the terms γ 11,, γ 33 into a 3 3 matrix: γ 11 γ 12 γ 13 M = γ 21 γ 22 γ 23 γ 31 γ 32 γ 33 then we have: u 1 u 2 u 3 = V M T That is, U = V M T The superscript T denotes matrix transpose 11

The same vector w represented in two coordinate systems We can write w = α 1 v 1 + α 2 v 2 + α 3 v 3 w = β 1 u 1 + β 2 u 2 + β 3 u 3 Each v i is a column vector of 3 components as follows: w = v 1 v 2 v 3 w = u 1 u 2 u 3 α 1 α 2 α 3 β 1 β 2 β 3 = V a = U b Let s call this 3 3 matrix V 12

Representing the Second Basis in Terms of the First (cont.) In this example, we have w = V a and w = U b. So V a = U b With U = V M T, we have V a = V M T b a = M T b Thus, a and b are related by M T 13

Change of Coordinate Frames We can apply a similar process in homogeneous coordinates to the representations of both points and vectors Consider two coordinate frames: (P 0, v 1, v 2, v 3 ) (Q 0, u 1, u 2, u 3 ) v 3 P 0 v 1 Any point or vector can be represented in either coordinate frame. We can represent (Q 0, u 1, u 2, u 3 ) in terms of (P 0, v 1, v 2, v 3 ) v 2 u 1 u 2 Q 0 u 3 14

Representing One Coordinate Frame in Terms of the Other We can extend what we did with the change of basis vectors: u 1 = γ 11 v 1 + γ 12 v 2 +γ 13 v 3 u 2 = γ 21 v 1 + γ 22 v 2 +γ 23 v 3 u 3 = γ 31 v 1 + γ 32 v 2 +γ 33 v 3 Q 0 = γ 41 v 1 + γ 42 v 2 +γ 43 v 3 + P 0 by replacing the 3 3 matrix M by a 4 4 matrix as follows: M = γ 11 γ 12 γ 13 0 γ 21 γ 22 γ 23 0 γ 31 γ 32 γ 33 0 γ 41 γ 42 γ 43 1 15

Working with Representations Within the two coordinate frames any point or vector has a representation of the same form: a = α 1 α 2 α 3 α 4 in the first frame b = β 1 β 2 β 3 β 4 in the second frame where a 4 = b 4 = 1 for points and a 4 = b 4 = 0 for vectors and a = M T b The matrix M T is 4 4 and specifies an affine transformation in homogeneous coordinates 16

A Few Common Transformations Rigid transformation: The 4 4 matrix has the form: R t 0 T 1 where R is a 3 3 rotation matrix and t R 3 is a translation vector. Rigid transformation preserves everything (angle (this means the shape), length, area, etc) Similarity transformation: The matrix has the form: sr t 0 T 1 or R t 0 T s Large (or small) s values enlarge (or diminish) the object Small (or large) s values enlarge (or diminish) the object where s, s 1. Similarity transformation preserves angle, ratios of lengths and of areas. 17

A Few Common Transformations (cont.) Affine transformation: The 4 4 matrix has the form: A 0 T 1 where A can be any 3 3 non-singular matrix and t R 3 is a translation vector. Affine transformation preserves parallelism, ratios of lengths. Perspective transformation: The matrix can be any nonsingular 4 4 matrix. Perspective transformation matrix preserves cross ratios (i.e., ratio of ratios of lengths). t 18

A Few Common Transformations (cont.) Rigid transformation is equivalent to a change in coordinate frames. It has 6 degrees of freedom (dof) i.e. 3 rotations + 3 translations (along each of the three axes) Similarity transformation has 7 dof (an additional scaling) Affine transformation has 12 dof because the 4 elements on the last row of the matrix are fixed 3 rotations + 3 translations + 3 scaling + 3 shear 19

The World and Camera Coordinate Frames When we work with representations, we work with n-tuples or arrays of scalars Changes in coordinate frame are then defined by 4 4 matrices In OpenGL, the base frame that we start with is the world frame Eventually we represent entities in the camera frame by changing the world representation using the modelview matrix Initially these frames are the same (i.e, M=I) 20

Moving the Camera If objects are on both sides of z = 0, we must move the camera coordinate frame, e.g., M = 1 0 0 0 0 1 0 0 0 0 0 0 1 0 d 1 21

General Transformations A transformation maps points to other points and/or vectors to other vectors v = T(u) Q=T(P) 22

Affine Transformations Preserving parallel lines Characteristic of many physically important transformations Rigid body transformations: rotation, translation Scaling, shear Importance in graphics is that we need only transform endpoints of line segments and let implementation draw line segment between the transformed endpoints 23

Pipeline Implementation T (from application program) u v transformation T(u) T(v) rasterizer frame buffer v T(v) T(v) u vertices (before transformation) T(u) vertices (after transformation) T(u) pixels 24

Notation We will be working with both coordinate-free representations of transformations and representations within a particular frame P, Q, R: points in an affine space p, q, r: representations of points - array of 4 scalars in homogeneous coordinates u, v, w: representations of vectors in an affine space - array of 4 scalars in homogeneous coordinates α, β, γ: scalars 25

Translation Move (translate, displace) a point to a new location P P Displacement determined by a vector d Three degrees of freedom d P = P + d 26

How many ways? Although we can move a point to a new location in an infinite number of ways, when we move many points (of a rigid object) there is usually only one way object translation: every point displaced by same vector 27

Translation using Representations Using the homogeneous coordinate representation in some frame p = [x y z 1] T p = [x y z 1] T d = [d x d y d z 0] T Hence p = p + d or x = x + d x y = y + d y z = z + d z note that this expression is in four dimensions and expresses point = vector + point 28

Translation Matrix We can also express translation using a 4 4 matrix T in homogeneous coordinates p = Tp where 1 0 0 d x 0 1 0 d T = T(d x, d y, d z ) = y 0 0 1 d z 0 0 0 1 This form is better for implementation because all affine transformations can be expressed this way and multiple transformations can be concatenated together 29

Further Reading Interactive Computer Graphics A Top-Down Approach with Shader-Based OpenGL by Edward Angel and Dave Shreiner, 6 th Ed, 2012 Sec 3.7 to 3.9