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

Similar documents
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

11.1 Three-Dimensional Coordinate System

Mathematics for 3D Graphics

A DARK GREY P O N T, with a Switch Tail, and a small Star on the Forehead. Any

In this section, mathematical description of the motion of fluid elements moving in a flow field is

GG303 Lecture 6 8/27/09 1 SCALARS, VECTORS, AND TENSORS

Announcements Wednesday, September 27

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

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

LECTURE 5, FRIDAY

Homework 1/Solutions. Graded Exercises

If the pull is downward (Fig. 1), we want C to point into the page. If the pull is upward (Fig. 2), we want C to point out of the page.

Homogeneous Transformations

Properties of surfaces II: Second moment of area

1.1 Single Variable Calculus versus Multivariable Calculus Rectangular Coordinate Systems... 4

Omm Al-Qura University Dr. Abdulsalam Ai LECTURE OUTLINE CHAPTER 3. Vectors in Physics

Exercise 1: Inertia moment of a simple pendulum

03 - Basic Linear Algebra and 2D Transformations

Lecture 8: Coordinate Frames. CITS3003 Graphics & Animation

Classical Mechanics. Luis Anchordoqui

Problem 1: (3 points) Recall that the dot product of two vectors in R 3 is

MAE 323: Lecture 1. Review

Problem Set 2 Due Tuesday, September 27, ; p : 0. (b) Construct a representation using five d orbitals that sit on the origin as a basis: 1

Vectors for Physics. AP Physics C

Matrix-Vector Products and the Matrix Equation Ax = b

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

Lecture Notes for MATH6106. March 25, 2010

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

CSC 470 Introduction to Computer Graphics. Mathematical Foundations Part 2

LOWELL WEEKLY JOURNAL

6. 3D Kinematics DE2-EA 2.1: M4DE. Dr Connor Myant

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Linear Algebra /34

Announcements Monday, September 18

Bidiagonal pairs, Tridiagonal pairs, Lie algebras, and Quantum Groups

Detailed objectives are given in each of the sections listed below. 1. Cartesian Space Coordinates. 2. Displacements, Forces, Velocities and Vectors

ALGEBRAIC GEOMETRY HOMEWORK 3

1. Vectors.

Algebraic Expressions

Math 51, Homework-2 Solutions

12. Stresses and Strains

Polynomials. In many problems, it is useful to write polynomials as products. For example, when solving equations: Example:

Chapter 2 Math Fundamentals

Transformations. Chapter D Transformations Translation

Matrix Arithmetic. a 11 a. A + B = + a m1 a mn. + b. a 11 + b 11 a 1n + b 1n = a m1. b m1 b mn. and scalar multiplication for matrices via.

LECTURE 10, MONDAY MARCH 15, 2004

MSMS Vectors and Matrices

x 9 or x > 10 Name: Class: Date: 1 How many natural numbers are between 1.5 and 4.5 on the number line?

A VERY BRIEF LINEAR ALGEBRA REVIEW for MAP 5485 Introduction to Mathematical Biophysics Fall 2010

ARC 341 Structural Analysis II. Lecture 10: MM1.3 MM1.13

7a3 2. (c) πa 3 (d) πa 3 (e) πa3

Neatest and Promptest Manner. E d i t u r ami rul)lihher. FOIt THE CIIILDIIES'. Trifles.

The Circle. 1 The equation of a circle. Nikos Apostolakis. Spring 2017

Review of Coordinate Systems

Problem Set # 1 Solution, 18.06

Department of Physics, Korea University

Vector and Affine Math

Problem Set 2 Due Thursday, October 1, & & & & # % (b) Construct a representation using five d orbitals that sit on the origin as a basis:

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

Applications of Eigenvalues & Eigenvectors

Chapter 2. Vectors and Vector Spaces

Affine transformations

Rigid Body Rotation. Speaker: Xiaolei Chen Advisor: Prof. Xiaolin Li. Department of Applied Mathematics and Statistics Stony Brook University (SUNY)

An overview of key ideas

MAC Module 5 Vectors in 2-Space and 3-Space II

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

CSE 167: Lecture 11: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Lesson Rigid Body Dynamics

MAT 419 Lecture Notes Transcribed by Eowyn Cenek 6/1/2012

Stress, Strain, Mohr s Circle

The geometry of least squares

MECH 5312 Solid Mechanics II. Dr. Calvin M. Stewart Department of Mechanical Engineering The University of Texas at El Paso

Last week we presented the following expression for the angles between two vectors u and v in R n ( ) θ = cos 1 u v

Rotational & Rigid-Body Mechanics. Lectures 3+4

Sec. 1.1: Basics of Vectors

(A B) 2 + (A B) 2. and factor the result.

Lesson 6. Diana Pell. Monday, March 17. Section 4.1: Solve Linear Inequalities Using Properties of Inequality

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Linear Algebra 1/33

I&C 6N. Computational Linear Algebra

Linear Algebra V = T = ( 4 3 ).

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

The Sphere OPTIONAL - I Vectors and three dimensional Geometry THE SPHERE

Algebraic Expressions and Identities

LOWELL JOURNAL. MUST APOLOGIZE. such communication with the shore as Is m i Boimhle, noewwary and proper for the comfort

(arrows denote positive direction)

Hilbert s Metric and Gromov Hyperbolicity

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

Two Posts to Fill On School Board

The CENTRE for EDUCATION in MATHEMATICS and COMPUTING cemc.uwaterloo.ca Cayley Contest. (Grade 10) Thursday, February 20, 2014

Linear Algebra Homework and Study Guide

Lagrange Multipliers

CHAPTER 4 Stress Transformation

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

Vectors and Matrices

A = 3 B = A 1 1 matrix is the same as a number or scalar, 3 = [3].

Lecture 4: Affine Transformations. for Satan himself is transformed into an angel of light. 2 Corinthians 11:14

Course 2BA1: Hilary Term 2007 Section 8: Quaternions and Rotations

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

Math 51, Homework-2. Section numbers are from the course textbook.

Math 302 Test 1 Review

Transcription:

CSE 167: Introduction to Computer Graphics Lecture #2: Linear Algebra Primer Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

Announcements Project 1 due next Friday at 2pm Grading window is 2-3:30pm Upload source code to TritonEd by 2pm 2 nd discussion of project 1 Monday at 4pm 2

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 3 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 4

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 5

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θ 6

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

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 aand b are parallel (or one or both degenerate) 8

Cross product 9

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

Matrix Addition 11

Multiplication With Scalar 12

Matrix Multiplication 13

Matrix-Vector Multiplication 14

Identity Matrix 15

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

Lecture Overview Affine Transformations Homogeneous Coordinates 17

Affine Transformations Most important for graphics: rotation, translation, scaling Wolfram MathWorld: An affine transformation is any transformation that preserves collinearity (i.e., all points lying on a line initially still lie on a line after transformation) and ratios of distances (e.g., the midpoint of a line segment remains the midpoint after transformation). Implemented using matrix multiplications 18

Uniform Scale Uniform scaling matrix in 2D Analogous in 3D 19

Non-Uniform Scale Nonuniform scaling matrix in 2D Analogous in 3D 20

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

Rotation in 3D Rotation around coordinate axes 22

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

Rotation about an Arbitrary Axis Complicated! Rotate point [x,y,z] about axis [u,v,w] by angle θ: 24

How to rotate around a Pivot Point? Rotation around origin: p = R p Rotation around pivot point: p =? 25

Rotating point p around a pivot point 1. Translation T 2. Rotation R 3. Translation T -1 p = T -1 R T p 26

Concatenating transformations Given a sequence of transformations M 3 M 2 M 1 Note: associativity applies: 27

Lecture Overview Affine Transformations Homogeneous Coordinates 28

Translation Translation in 2D t x t y Translation matrix? Analogous in 3D: 4x4 matrix 29

Homogeneous Coordinates Basic: a trick to unify/simplify computations. Deeper: projective geometry Interesting mathematical properties Good to know, but less immediately practical We will use some aspect of this when we do perspective projection 30

Homogeneous Coordinates Add an extra component. 1 for a point, 0 for a vector: p = Combine M and d into single 4x4 matrix: p x p y p z 1 And see what happens when we multiply r v = v x v y v z 0 m xx m xy m xz d x m yx m yy m yz d y m zx m zy m zz d z 0 0 0 1 31

Homogeneous Point Transform Transform a point: p x p y p z 1 = m xx m xy m xz d x m yx m yy m yz d y m zx m zy m zz d z 0 0 0 1 p x p y p z 1 = m xx p x + m xy p y + m xz p z + d x m yx p x + m yy p y + m yz p z + d y m zx p x + m zy p y + m zz p z + d z 0 + 0 + 0 + 1 Top three rows are the affine transform! Bottom row stays 1 M p x p y p z + r d 32

Homogeneous Vector Transform Transform a vector: v x v y v z 0 = m xx m xy m xz d x m yx m yy m yz d y m zx m zy m zz d z 0 0 0 1 v x v y v z 0 = m xx v x + m xy v y + m xz v z + 0 m yx v x + m yy v y + m yz v z + 0 m zx v x + m zy v y + m zz v z + 0 0 + 0 + 0 + 0 M v x v y v z Top three rows are the linear transform Displacement d is properly ignored Bottom row stays 0 33

Homogeneous Arithmetic Legal operations always end in 0 or 1! M vector+vector: 0 + M M 0 0 M vector-vector: 0 M M 0 0 scalar*vector: s M M 0 0 M point+vector: 1 + M M 0 1 M point-point: 1 M M 1 0 M point+point: 1 + M M 1 2 scalar*point: s M M 1 s weighted average affine combination of points: 1 M 3 1 + 2 M 3 M 1 1 34

Homogeneous Transforms Rotation, Scale, and Translation of points and vectors unified in a single matrix transformation: p = M p Matrix has the form: Last row always 0,0,0,1 m xx m xy m xz d x m yx m yy m yz d y m zx m zy m zz d z 0 0 0 1 Transforms compose by matrix multiplication! Same caveat: order of operations is important Same note: Transforms operate right-to-left 35