CSC 470 Introduction to Computer Graphics. Mathematical Foundations Part 2

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

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

Lecture 2: Vector-Vector Operations

Review of Coordinate Systems

Vectors and Matrices

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

Matrix Basic Concepts

Remark 3.2. The cross product only makes sense in R 3.

Matrices Gaussian elimination Determinants. Graphics 2009/2010, period 1. Lecture 4: matrices

Linear Algebra V = T = ( 4 3 ).

Review: Linear and Vector Algebra

Quiz No. 1: Tuesday Jan. 31. Assignment No. 2, due Thursday Feb 2: Problems 8.4, 8.13, 3.10, 3.28 Conceptual questions: 8.1, 3.6, 3.12, 3.

I&C 6N. Computational Linear Algebra

Linear Algebra March 16, 2019

CS 4204 Computer Graphics

MATH 19520/51 Class 2

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

n n matrices The system of m linear equations in n variables x 1, x 2,..., x n can be written as a matrix equation by Ax = b, or in full

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

Section 13.4 The Cross Product

Review of Linear Algebra

LINEAR ALGEBRA - CHAPTER 1: VECTORS

Friday, 2 November 12. Vectors

MODEL ANSWERS TO HWK #1

03 - Basic Linear Algebra and 2D Transformations

Distance Between Ellipses in 2D

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

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

Lecture 8: Coordinate Frames. CITS3003 Graphics & Animation

Vectors and the Geometry of Space

What you will learn today

Vectors a vector is a quantity that has both a magnitude (size) and a direction

is Use at most six elementary row operations. (Partial

NOTES FOR LINEAR ALGEBRA 133

2- Scalars and Vectors

22A-2 SUMMER 2014 LECTURE Agenda

High School Math Contest

Chapter 8. Rigid transformations

Lecture 3: Matrix and Matrix Operations

Matrix Operations: Determinant

10.2,3,4. Vectors in 3D, Dot products and Cross Products

The geometry of least squares

A matrix over a field F is a rectangular array of elements from F. The symbol

chapter 1 vector geometry solutions V Consider the parallelogram shown alongside. Which of the following statements are true?

Linear Algebra I. Ronald van Luijk, 2015

Extra Problems for Math 2050 Linear Algebra I

This appendix provides a very basic introduction to linear algebra concepts.

Math 241, Exam 1 Information.

Vectors are used to represent quantities such as force and velocity which have both. and. The magnitude of a vector corresponds to its.

Lecture 7. Econ August 18

Rigid Geometric Transformations

CHAPTER 10 VECTORS POINTS TO REMEMBER

Linear Algebra (Review) Volker Tresp 2017

3 Vectors. 18 October 2018 PHY101 Physics I Dr.Cem Özdoğan

MAT1035 Analytic Geometry

X- MATHS IMPORTANT FORMULAS SELF EVALUVATION 1. SETS AND FUNCTIONS. 1. Commutative property i ii. 2. Associative property i ii

Phys 201. Matrices and Determinants

GEOMETRY OF MATRICES x 1

Linear Algebra Homework and Study Guide

Linear Algebra Review. Vectors

The Cross Product of Two Vectors

Linear Algebra (Review) Volker Tresp 2018

9.1 VECTORS. A Geometric View of Vectors LEARNING OBJECTIVES. = a, b

Vectors are used to represent quantities such as force and velocity which have both. and. The magnitude of a vector corresponds to its.

Matrices and RRE Form

NAEP Questions, Pre-Algebra, Unit 13: Angle Relationships and Transformations

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

Matrices and Vectors

Mathematics for Graphics and Vision

Matrix Operations. Linear Combination Vector Algebra Angle Between Vectors Projections and Reflections Equality of matrices, Augmented Matrix

Matrix & Linear Algebra

Chapter 3. Vectors and. Two-Dimensional Motion Vector vs. Scalar Review

Part I, Number Systems CS131 Mathematics for Computer Scientists II Note 3 VECTORS

BLUE PRINT - III MATHEMATICS - XII. (b) Applications of Derivatives (1) 44 (11) (b) 3 - dimensional geometry - 4 (1) 6 (1) 17 (6)

Rigid Geometric Transformations

Section 8.1 Vector and Parametric Equations of a Line in

LS.1 Review of Linear Algebra

Part (1) Second : Trigonometry. Tan

Linear Algebra. Alvin Lin. August December 2017

The Cross Product. In this section, we will learn about: Cross products of vectors and their applications.

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

High School Math Contest

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

Essential Mathematics for Computer Graphics

9.4 Polar Coordinates

MATH 243 Winter 2008 Geometry II: Transformation Geometry Solutions to Problem Set 1 Completion Date: Monday January 21, 2008

X- MATHS IMPORTANT FORMULAS SELF EVALUVATION

Integrated Math II. IM2.1.2 Interpret given situations as functions in graphs, formulas, and words.

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

CSE4030 Introduction to Computer Graphics

Mathematical Fundamentals

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

Unit 8. ANALYTIC GEOMETRY.

ELEMENTARY LINEAR ALGEBRA

Elementary maths for GMT

Cartesian coordinates in space (Sect. 12.1).

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

GEOMETRY AND VECTORS

a b 0 a cos u, 0 u 180 :

BSc (Hons) in Computer Games Development. vi Calculate the components a, b and c of a non-zero vector that is orthogonal to

Transcription:

CSC 47 Introduction to Computer Graphics Mathematical Foundations Part 2

Vector Magnitude and Unit Vectors The magnitude (length, size) of n-vector w is written w 2 2 2 w = w + w2 + + w n Example: the magnitude of w = (4, -2) is 2 and that of w = (, -3, 2) is 4 A unit vector has magnitude v = The unit vector pointing in the same direction as vector a is a (if a ) a ˆ = a Converting a to â is called normalizing vector a

Dot Product of Two Vectors The dot product of n-vectors n v and w is v w = v w + v 2 w 2 + + v n w n The dot product is commutative: v w = w v The dot product is distributive: (a( ± b) c = a c ± b c The dot product is associative over multiplication by a scalar: (sa) b( = s(a b) The dot product of a vector with itself is its magnitude squared: b b = b 2

Standard Unit Vectors The standard unit vectors in 3D are i = (,,), j = (,, ), and k = (,, ) k always points in the positive z direction In 2D, i = (,) and j = (, ) The unit vectors are orthogonal

Application of Projection: Reflections A reflection occurs when light hits a shiny surface (below) or when a billiard ball hits the wall edge of a table

Reflections cont d When light reflects from a mirror, the angle of reflection must equal the angle of incidence: θ = θ 2 Vectors and projections allow us to compute the new direction r,, in either two-dimensions or three dimensions a) n a r θ θ2 b) n a r -m m L e e

Vector Cross Product (3D Vectors Only) a x b = (a( y b z a z b y )i + (a z b x a x b z )j + (a x b y a y b x )k The determinant below also gives the result: a b = i j k a x a y a z b x b y b z

Properties of the Cross-Product i x j = k; j x k = i; k x i = j a x b = - b x a; a x (b( ± c) ) = a x b ± a x c; ; (sa)( ) x b = s(a x b) a x (b( x c) (a x b) ) x c for example, a = (a x, a y, ), b = (b( x, b y, ), c = (,, c z ) c = a x b is perpendicular to a and to b The direction of c is given by a right/left hand rule in a right/left-handed handed coordinate system

Properties cont d a (a x b) ) = a x b = a b sin θ,, where θ is the smaller angle between a and b a x b is also the area of the parallelogram formed by a and b a x b = if a and b point in the same or opposite directions, or if one or both has length

Geometric Interpretation of the Cross Product

Application: Finding the Normal to a Plane Given any 3 non-collinear points A, B, and C in a plane, we can find a normal to the plane: a = B A, b = C A, n = a x b The normal on the other side of the plane is n

Changing to and from Homogeneous Coordinates To: if the object is a vector, add a as the 4 th coordinate; if it is a point, add a From: simply remove the 4 th coordinate OpenGL uses 4D homogeneous coordinates for all its vertices If you send it a 3-tuple 3 in the form (x,( y, z), it converts it immediately to (x,( y, z,, ) If you send it a 2D point (x,( y), it first appends a for the z-component z and then a, to form (x,( y,,, ) All computations are done within OpenGL in 4D homogeneous coordinates

Combinations Linear combinations of vectors and points: The difference of 2 points is a vector: the fourth component is = The sum of a point and a vector is a point: the fourth component is + = The sum of 2 vectors is a vector: + = A vector multiplied by a scalar is still a vector: a x = Linear combinations of vectors are vectors

Point + Vector Suppose we add a point A and a vector that has been scaled by a factor t: the result is a point, P = A + tv Now suppose v = B A, the difference of 2 points: P = tb + (-t)a, an affine combination of points

Representing Planes: Point-Normal Form Point-normal normal form: n (P B) = ; where B is a given point on the plane, and P = (x, y, z, ) T

Finding A Circle through 3 Points We want to find the center and the radius of the circle The 3 points make a triangle, and the center S is where the perpendicular bisectors of two of the sides of the triangle meet The radius is r = A S

Clipping lines Clipping algorithm that clips off outlying parts of each line segment presented to it

Clipping a Polygon To clip a polygon against a window means to find which part of the polygon is inside the window and thus will be drawn

Clipping cont d The method we will use is called Cohen- Sutherland clipping There are 2 trivial cases: a line AB totally inside the window, which we draw all of, and a line CD totally outside the window, which we do not draw at all

Clipping polygons

Clip4 Clip5

Vectors and Matrices Matrix is an array of numbers with dimensions M (rows) by N (columns) 3 by 6 matrix element 2,3 is (3) Vector can be considered a x M matrix v = ( x y z ) 3 5 2 3 2 4 2

Types of Matrix Identity matrices - I Diagonal 2 4 Symmetric a b b d c e c e f Diagonal matrices are (of course) symmetric Identity matrices are (of course) diagonal

Operation on Matrices Operation on Matrices Addition Addition Done elementwise Done elementwise Transpose Transpose Flip (M by N becomes N by M) Flip (M by N becomes N by M) = 3 8 9 7 2 4 6 5 3 7 6 8 2 5 9 4 T

Operations on Matrices Multiplication Only possible to multiply of dimensions x by y and x 2 by y 2 iff y = x 2 resulting matrix is x by y 2 eg Matrix A is 2 by 3 and Matrix by 3 by 4 resulting matrix is 2 by 4 Just because A x B is possible doesn t mean B x A is possible!

Matrix Multiplication Order Matrix Multiplication Order A is n by k, B is k by m A is n by k, B is k by m C = A x B defined by C = A x B defined by BxA BxA not necessarily equal not necessarily equal to to AxB AxB = = k l lj il ij b a c = = =

Example Multiplications Example Multiplications = 2 3 2 = 3 3 2 2

Inverse Matrix If A x B = I and B x A = I then A = B - and B = A -

Vectors and Matrices Matrix is an array of numbers with dimensions M (rows) by N (columns) 3 by 6 matrix element 2,3 is (3) Vector can be considered a x M matrix v = ( x y z ) 3 5 2 3 2 4 2

Types of Matrix Identity matrices - I Diagonal 2 4 Symmetric a b b d c e c e f Diagonal matrices are (of course) symmetric Identity matrices are (of course) diagonal

Operation on Matrices Operation on Matrices Addition Addition Done elementwise Done elementwise Transpose Transpose Flip (M by N becomes N by M) Flip (M by N becomes N by M) = 3 8 9 7 2 4 6 5 3 7 6 8 2 5 9 4 T

Operations on Matrices Multiplication Only possible to multiply of dimensions x by y and x 2 by y 2 iff y = x 2 resulting matrix is x by y 2 eg Matrix A is 2 by 3 and Matrix by 3 by 4 resulting matrix is 2 by 4 Just because A x B is possible doesn t mean B x A is possible!

Matrix Multiplication Order Matrix Multiplication Order A is n by k, B is k by m A is n by k, B is k by m C = A x B defined by C = A x B defined by BxA BxA not necessarily equal not necessarily equal to to AxB AxB = = k l lj il ij b a c = = =

Example Multiplications Example Multiplications = 2 3 2 = 3 3 2 2

Inverse Matrix If A x B = I and B x A = I then A = B - and B = A -