Mathematics for 3D Graphics

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

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

Review of Coordinate Systems

Lecture 2: Vector-Vector Operations

Vectors. September 2, 2015

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

Introduction to Vectors

Vectors and Matrices

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

Mathematics for Graphics and Vision

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

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Linear Algebra /34

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Linear Algebra 1/33

Linear Algebra. 1.1 Introduction to vectors 1.2 Lengths and dot products. January 28th, 2013 Math 301. Monday, January 28, 13

Linear Algebra Homework and Study Guide

CSC 470 Introduction to Computer Graphics. Mathematical Foundations Part 2

10.1 Vectors. c Kun Wang. Math 150, Fall 2017

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

1 Last time: multiplying vectors matrices

Definition 1. A set V is a vector space over the scalar field F {R, C} iff. there are two operations defined on V, called vector addition

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

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

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

Chapter 2. Vectors and Vector Spaces

Vectors. Vector Practice Problems: Odd-numbered problems from

Vectors. Vectors. Vectors. Reminder: Scalars and Vectors. Vector Practice Problems: Odd-numbered problems from

I&C 6N. Computational Linear Algebra

Course Notes Math 275 Boise State University. Shari Ultman

Vector Spaces. Chapter 1

6. Linear Transformations.

4.1 Distance and Length

Math (P)Review Part I:

Math 3C Lecture 20. John Douglas Moore

Vectors for Physics. AP Physics C

Vector and Affine Math

System of Linear Equations

The Cross Product. Philippe B. Laval. Spring 2012 KSU. Philippe B. Laval (KSU) The Cross Product Spring /

Friday, 2 November 12. Vectors

MAT 1339-S14 Class 8

Vector calculus background

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

Section 13.4 The Cross Product

Vector/Matrix operations. *Remember: All parts of HW 1 are due on 1/31 or 2/1

Mathematical Foundations: Intro

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

MATH 423 Linear Algebra II Lecture 3: Subspaces of vector spaces. Review of complex numbers. Vector space over a field.

(1) Recap of Differential Calculus and Integral Calculus (2) Preview of Calculus in three dimensional space (3) Tools for Calculus 3

Vectors Part 1: Two Dimensions

General Physics I, Spring Vectors

Math 241, Exam 1 Information.

MATH 20F: LINEAR ALGEBRA LECTURE B00 (T. KEMP)

MATH Topics in Applied Mathematics Lecture 12: Evaluation of determinants. Cross product.

Vector Geometry. Chapter 5

CITS2401 Computer Analysis & Visualisation

Homogeneous Transformations

Physics 342 Lecture 2. Linear Algebra I. Lecture 2. Physics 342 Quantum Mechanics I

OLLSCOIL NA heireann MA NUAD THE NATIONAL UNIVERSITY OF IRELAND MAYNOOTH MATHEMATICAL PHYSICS EE112. Engineering Mathematics II

2.1 Definition. Let n be a positive integer. An n-dimensional vector is an ordered list of n real numbers.

Information About Ellipses

This pre-publication material is for review purposes only. Any typographical or technical errors will be corrected prior to publication.

Linear Algebra March 16, 2019

Physics 40 Chapter 3: Vectors

GEOMETRY AND VECTORS

MATH 19520/51 Class 2

The Cross Product of Two Vectors

Vectors. Introduction. Prof Dr Ahmet ATAÇ

Vectors for Zero Robotics students

Matrix Algebra: Vectors

Lecture 1 Complex Numbers. 1 The field of complex numbers. 1.1 Arithmetic operations. 1.2 Field structure of C. MATH-GA Complex Variables

Quantities which have only magnitude are called scalars. Quantities which have magnitude and direction are called vectors.

Vector is a quantity which has both magnitude and direction. We will use the arrow to designate vectors.

Linear Equation: a 1 x 1 + a 2 x a n x n = b. x 1, x 2,..., x n : variables or unknowns

What you will learn today

- 1 - Items related to expected use of technology appear in bold italics.

03 - Basic Linear Algebra and 2D Transformations

Vectors Year 12 Term 1

Math 416, Spring 2010 More on Algebraic and Geometric Properties January 21, 2010 MORE ON ALGEBRAIC AND GEOMETRIC PROPERTIES

Lecture 16: Projection and Cameras. October 17, 2017

Worksheet 1.4: Geometry of the Dot and Cross Products

ENGI 9420 Lecture Notes 2 - Matrix Algebra Page Matrix operations can render the solution of a linear system much more efficient.

ROOTS COMPLEX NUMBERS

Department of Physics, Korea University

Lecture 1: Systems of linear equations and their solutions

(arrows denote positive direction)

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

Unit IV: Introduction to Vector Analysis

Linear Algebra Using MATLAB

A Review of Linear Algebra

Vectors. Introduction

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

Projectile Motion and 2-D Dynamics

Physics 342 Lecture 2. Linear Algebra I. Lecture 2. Physics 342 Quantum Mechanics I

3D Coordinate Transformations. Tuesday September 8 th 2015

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

Mathematics 308 Geometry. Chapter 2. Elementary coordinate geometry

Extra Problems for Math 2050 Linear Algebra I

FORCE TABLE INTRODUCTION

Vectors. The standard geometric definition of vector is as something which has direction and magnitude but not position.

Chapter 2 Mechanical Equilibrium

Transcription:

math 1 Topics Mathematics for 3D Graphics math 1 Points, Vectors, Vertices, Coordinates Dot Products, Cross Products Lines, Planes, Intercepts References Many texts cover the linear algebra used for 3D graphics...... the texts below are good references, Akenine-Möller is more relevant to the class. Appendix A in T. Akenine-Möller, E. Haines, N. Hoffman, Real-Time Rendering, Third Edition, A. K. Peters Ltd. Appendix A in Foley, van Dam, Feiner, Huges, Computer Graphics: Principles and Practice, Second Edition, Addison Wesley. math 1 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 1

math 2 Points and Vectors math 2 Point: Indivisible location in space. E.g., P 1 = [ 1 2 3 ], P 2 = [ 4 5 6 ] Vector: Difference between two points. E.g., V = P 2 P 1 = P 1 P 2 = Equivalently: P 2 = P 1 + V. [ ] 4 1 5 2 6 3 = [ 3 3 3 ]. Don t confuse points and vectors! math 2 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 2

math 3 math 3 Point-Related Terminology Will define several terms related to points. At times they may be used interchangeably. Point: A location in space. Coordinate: A representation of location. Vertex: Term may mean point, coordinate, or part of graphical object. As used in class, vertex is a less formal term. It might refer to a point, its coordinate, and other info like color. math 3 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 3

math 4 math 4 Coordinate: A representation of where a point is located. Familiar representations: 3D Cartesian P = (x, y, z). 2D Polar P = (r, θ). In class we will use 3D homogeneous coordinates. math 4 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 4

math 5 Homogeneous Coordinates math 5 Homogeneous Coordinate: A coordinate representation for points in 3D space consisting of four components...... each component is a real number...... and the last component is non-zero. Representation: P = x y z, where w 0. w P refers to same point as Cartesian coordinate (x/w,y/w,z/w). To save paper sometimes written as (x,y,z,w). math 5 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 5

math 6 Homogeneous Coordinates math 6 Each point can be described by many homogeneous coordinates... 10 5 20 10w 20 10 40 20w... for example, (10,20,30) = 30 = 15 = 60 = 30w =... 1 0.5 2 w... these are all equivalent so long as w 0. Column matrix... but it could be a vector. x y z could not be a homogeneous coordinate... 0 math 6 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 6

math 7 Homogeneous Coordinates math 7 Why not just Cartesian coordinates like (x,y,z)? The w simplifies certain computations. Confused? Then for a little while pretend that x y is just (x, y, z). z 1 math 7 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 7

math 8 math 8 Homogenized Homogeneous Coordinate A homogeneous coordinate is homogenized by dividing each element by the last. For example, the homogenization of x y is z w x/w y/w z/w 1 Homogenization is also known as perspective divide. math 8 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 8

math 9 Vector Arithmetic Vector Arithmetic math 9 Points just sit there, it s vectors that do all the work. In other words, most operations defined on vectors. Point/Vector Sum The result of adding a point to a vector is a point. Consider point with homogenized coordinate P = (x, y, z, 1) and vector V = (i, j, k). The sum P + V is the point with coordinate This follows directly from the vector definition. x y + i j = z k 1 x + i y + j z + k 1 math 9 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 9

math 10 math 10 Scalar/Vector Multiplication The result of multiplying scalar a with a vector is a vector...... that is a times longer but points in the same or opposite direction...... if a 0. Let a denote a scalar real number and V a vector. The scalar vector product is av = a x y z = ax ay az. math 10 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 10

math 11 math 11 Vector/Vector Addition The result of adding two vectors is another vector. Let V 1 = x 1 y 1 z 1 and V 2 = x 2 y 2 z 2 The vector sum, denoted U + V, is denote two vectors. x 1 + x 2 y 1 + y 2 z 1 + z 2 Vector subtraction could be defined similarly...... but doesn t need to be because we can use scalar/vector multiplication: V 1 V 2 = V 1 + ( 1 V 2 ). math 11 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 11

math 12 math 12 Vector Addition Properties Vector addition is associative: U + (V + W) = (U + V ) + W. Vector addition is commutative: U + V = V + U. math 12 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 12

math 13 Vector Magnitude Vector Magnitude, Normalization math 13 The magnitude of a vector is its length, a scalar. The magnitude of V = x y z denoted V, is x 2 + y 2 + z 2. The magnitude is also called the length and the norm. Vector V is called a unit vector if V = 1. A vector is normalized by dividing each of its components by its length. The notation ˆV indicates V/ V, the normalized version of V. math 13 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 13

math 14 The Vector Dot Product Dot Product math 14 The dot product of two vectors is a scalar. Roughly, it indicates how much they point in the same direction. Consider vectors V 1 = x 1 y 1 z 1 and V 2 = x 2 y 2 z 2 The dot product of V 1 and V 2, denoted V 1 V 2, is x 1 x 2 + y 1 y 2 + z 1 z 2.. math 14 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 14

math 15 Let U, V, and W be vectors. Let a be a scalar. Dot Product Properties math 15 Miscellaneous Dot Product Properties (U + V ) W = U W + V W (au) V = a(u V ) U V = V U abs(u U) = U 2 math 15 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 15

math 16 Orthogonality Dot Product Properties math 16 The more casual term is perpendicular. Vectors U and V are called orthogonal iff U V = 0. This is an important property for finding intercepts. math 16 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 16

math 17 Angle Let U and V be two vectors. Dot Product Properties math 17 Then U V = U V cos φ...... where φ is the smallest angle between the two vectors. math 17 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 17

math 18 Cross Product Cross Product math 18 The cross product of two vectors results in a vector orthogonal to both. The cross product of vectors V 1 and V 2, denoted V 1 V 2, is V 1 V 2 = x 1 y 1 z 1 x 2 y 2 z 2 = y 1z 2 z 1 y 2 z 1 x 2 x 1 z 2 x 1 y 2 y 1 x 2. math 18 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 18

math 19 Cross Product Properties Cross Product Properties math 19 Let U and V be two vectors and let W = U V. Then both U and V are orthogonal to W. U V = U V sinφ. U V = V U. (au + bv ) W = a(u W) + b(v W). If U and V define a parallelogram, its area is U V...... if they define a triangle its area is 1 2 U V. math 19 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 19

math 20 Lines, Planes, Intercepts math 20 Lines, planes, and intercepts covered on the blackboard. math 20 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 20

math 21 Sample Problem math 21 Problem: A light model specifies that in a scene with a light of brightness b (scalar) at location L (coordinate), and a point P on a surface with normal ˆn, the lighted color, c, of P (a scalar) will be the dot product of the surface normal with the direction to the light divided by the distance to the light. Restate this as a formula. Estimate the number of floating point operations in a streamlined computation. Solution: Formula: c = b PL ˆn 1. PL math 21 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 21

math 22 Transforms math 22 Transformation: A mapping (conversion) from one coordinate set to another (e.g., from feet to meters) or to a new location in an existing coordinate set. Particular Transformations to be Covered Translation: Moving things around. Scale: Change size. Rotation: Rotate around some axis. Projection: Moving to a surface. Transform by multiplying 4 4 matrix with coordinate. P new = M transform P old. math 22 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 22

math 23 Scale Transform S(s,t,u) = s 0 0 0 0 t 0 0 0 0 u 0 0 0 0 1. Transforms math 23 S(s, t, u) stretches an object s times along the x-axis, t times along the y-axis, and u times along the z-axis. Scaling centered on the origin. math 23 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 23

math 24 Transforms math 24 Rotation Transformations R x (θ) rotates around x axis by θ; likewise for R y and R z. R x (θ) = R y (θ) = R z (θ) = 1 0 0 0 0 cos θ sin θ 0 0 sin θ cos θ 0. 0 0 0 1 cos θ 0 sin θ 0 0 1 0 0 sinθ 0 cos θ 0. 0 0 0 1 cos θ sinθ 0 0 sinθ cos θ 0 0 0 0 1 0. 0 0 0 1 math 24 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 24

math 25 Translation Transform T(s,t,u) = 1 0 0 s 0 1 0 t 0 0 1 u 0 0 0 1. Transforms math 25 Moves point s units along x axis, etc. math 25 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 25

math 26 Transforms and Matrix Arithmetic math 26 Miscellaneous Matrix Multiplication Math Let M and N denote arbitrary 4 4 matrices. Identity Matrix I = 1 0 0 0 0 1 0 0. 0 0 1 0 0 0 0 1 IM = MI = M. math 26 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 26

math 27 Matrix Inverse Transforms and Matrix Arithmetic math 27 Matrix A is an inverse of M iff AM = MA = I. Will use M 1 to denote inverse. Not every matrix has an inverse. Computing inverse of an arbitrary matrix expensive...... but inverse of some matrices are easy to compute...... for example, T(x, y, z) 1 = T( x, y, z). Matrix Multiplication Rules Is associative: (LM)N = L(MN). Is not commutative: MN NM for arbitrary M and N. (MN) 1 = N 1 M 1. (Note change in order.) math 27 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 27

math 28 Projection Transformations math 28 Projection Transform: A transform that maps a coordinate to a space with fewer dimensions. A projection transform will map a 3D coordinate from our physical or graphical model...... to a 2D location on our monitor (or a window). Projection Types Vague definitions on this page. Perspective Projection Points appear to be in correct location,...... as though monitor were just a window into the simulated world. This projection used when realism is important. math 28 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 28

math 29 math 29 Orthographic Projection A projection without perspective foreshortening. This projection used when a real ruler will be used to measure distances. math 29 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 29

math 30 Perspective Projection Derivation math 30 Lets put user and user s monitor in world coordinate space: Location of user s eye: E. A point on the user s monitor: Q. Normal to user s monitor pointing away from user: n. Goal: Find S, point where line from E to P intercepts monitor (plane Q, n). Line from E to P called the projector. The user s monitor is in the projection plane. The point S is called the projection of point P on the projection plane. math 30 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 30

math 31 math 31 Solution: Projector equation: S = E + t EP. Projection plane equation: QS n = 0. Find point S that s on projector and projection plane: Q(E + t EP) n = 0 (E + t EP Q) n = 0 QE n + t EP n = 0 EQ n t = EP n EQ n S = E + EP EP n Note: EQ n is distance from user to plane in direction n...... and EP n is distance from user to point in direction n. math 31 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 31

math 32 To simplify projection: Perspective Projection Derivation math 32 Fix E = (0, 0, 0): Put user at origin. Fix n = (0, 0, 1): Make monitor parallel to xy plane. Result: S = E + EQ n EP EP n S = q z p z P, where q z is the z component of Q, and p z defined similarly. The key operation in perspective projection is dividing out by z (given our geometry). math 32 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 32

math 33 Simple Perspective Projection Transformation math 33 Simple Projection Transform Eye at origin, projection surface at (x, y, q z ), normal is (0, 0, 1). Note: F qz x y = z 1 q z x q z y = q z z F qz = q z z x q z z y q z z 1 q z 0 0 0 0 q z 0 0 0 0 0 q z 0 0 1 0 This maps z coordinates to q z /z, which will be useful. math 33 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 33

math 34 Frustum Perspective Transform math 34 Frustum Perspective Transform Given six values: l, r, t, b, n, f (left, right, top, bottom, near, far). Eye at origin, projection surface at (x, y, n), normal is (0, 0, 1). Viewer screen is rectangle from (l, b, n) to (r, t, n). Points with z > t and z < f are not of interest. F l,r,t,b,n,f = 2n r+l r l 0 0 2n t b r l 0 t+b t b 0 0 0 f+n f n 0 0 1 0 2 fn f n math 34 EE 7700-1 Lecture Transparency. Formatted 10:16, 29 January 2010 from set-1-math. math 34