Computer Graphics Mathematical Fundamentals Lecture 10 Taqdees A. Siddiqi

Slides:



Advertisements
Similar presentations
Chapter 4 Euclidean Vector Spaces
Advertisements

CS 450: COMPUTER GRAPHICS LINEAR ALGEBRA REVIEW SPRING 2015 DR. MICHAEL J. REALE.
Coordinatate systems are used to assign numeric values to locations with respect to a particular frame of reference commonly referred to as the origin.
Maths for Computer Graphics
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
6 6.1 © 2012 Pearson Education, Inc. Orthogonality and Least Squares INNER PRODUCT, LENGTH, AND ORTHOGONALITY.
Chapter 4.1 Mathematical Concepts
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
Now Playing: My Mathematical Mind Spoon From Gimme Fiction Released May 10, 2005.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Computer Graphics CSC 630 Lecture 2- Linear Algebra.
CSci 6971: Image Registration Lecture 2: Vectors and Matrices January 16, 2004 Prof. Chuck Stewart, RPI Dr. Luis Ibanez, Kitware Prof. Chuck Stewart, RPI.
Chapter 2: Vectors Ian Parberry University of North Texas Fletcher Dunn Valve Software 3D Math Primer for Graphics and Game Development.
MOHAMMAD IMRAN DEPARTMENT OF APPLIED SCIENCES JAHANGIRABAD EDUCATIONAL GROUP OF INSTITUTES.
6 6.1 © 2012 Pearson Education, Inc. Orthogonality and Least Squares INNER PRODUCT, LENGTH, AND ORTHOGONALITY.
Vectors.
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
Vectors and Scalars Vector and scalar quantities Adding vectors geometrically Components Unit Vectors Dot Products Cross Products pps by C Gliniewicz.
Group members: M.Shozib, Hasnain Khan, M.Awais, Shahid Rafiq Asad ali.
Matrix Definition A Matrix is an ordered set of numbers, variables or parameters. An example of a matrix can be represented by: The matrix is an ordered.
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 3. Vector 1. Adding Vectors Geometrically
Basics of Linear Algebra A review?. Matrix  Mathematical term essentially corresponding to an array  An arrangement of numbers into rows and columns.
Chapter 1 Number Sense See page 8 for the vocabulary and key concepts of this chapter.
Mathematical Fundamentals
Eigenvectors and Eigenvalues
Chapter 10 Review: Matrix Algebra
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
ECON 1150 Matrix Operations Special Matrices
Little Linear Algebra Contents: Linear vector spaces Matrices Special Matrices Matrix & vector Norms.
Chapter 4.1 Mathematical Concepts
Vectors. Vectors and Direction Vectors are quantities that have a size and a direction. Vectors are quantities that have a size and a direction. A quantity.
Introduction and Vectors
Elementary Linear Algebra Anton & Rorres, 9th Edition
CSCE 552 Spring 2011 Math By Jijun Tang. Layered.
1 Math Review Coordinate systems 2-D, 3-D Vectors Matrices Matrix operations.
Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1 : “shiv rpi” Linear Algebra A gentle introduction Linear Algebra has become as basic and as applicable.
Section 10.2a VECTORS IN THE PLANE. Vectors in the Plane Some quantities only have magnitude, and are called scalars … Examples? Some quantities have.
Statistics and Linear Algebra (the real thing). Vector A vector is a rectangular arrangement of number in several rows and one column. A vector is denoted.
Introduction to Matrices and Vectors Sebastian van Delden USC Upstate
5. Math1 Agenda r 1. Tools r 2. Matrices r 3. Least squares r 4. Propagation of variances r 5. Geometry.
Chun-Yuan Lin Mathematics for Computer Graphics 2015/12/15 1 CG.
8.1 and 8.2 answers. 8.3: Vectors February 9, 2009.
Vectors in Two Dimensions. VECTOR REPRESENTATION A vector represents those physical quantities such as velocity that have both a magnitude and a direction.
Algebra Matrix Operations. Definition Matrix-A rectangular arrangement of numbers in rows and columns Dimensions- number of rows then columns Entries-
Kinematics & Dynamics in 2 & 3 Dimensions; Vectors First, a review of some Math Topics in Ch. 1. Then, some Physics Topics in Ch. 4!
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
CS 450: COMPUTER GRAPHICS TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
Physics 141Mechanics Lecture 3 Vectors Motion in 2-dimensions or 3-dimensions has to be described by vectors. In mechanics we need to distinguish two types.
Learning from the Past, Looking to the Future James R. (Jim) Beaty, PhD - NASA Langley Research Center Vehicle Analysis Branch, Systems Analysis & Concepts.
Computer Graphics Lecture 11 2D Transformations I Taqdees A. Siddiqi
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry "Old Henry And His Old Aunt" Defined using right triangle  x y h.
Coordinatate systems are used to assign numeric values to locations with respect to a particular frame of reference commonly referred to as the origin.
Matrix Algebra Definitions Operations Matrix algebra is a means of making calculations upon arrays of numbers (or data). Most data sets are matrix-type.
Graphics Graphics Korea University kucg.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실.
Lecture 1 Linear algebra Vectors, matrices. Linear algebra Encyclopedia Britannica:“a branch of mathematics that is concerned with mathematical structures.
MTH108 Business Math I Lecture 20.
Linear Algebra Review.
Math Fundamentals Maths revisit.
Matrices Rules & Operations.
Matrix Operations Monday, August 06, 2018.
Lecture 03: Linear Algebra
2. Matrix Algebra 2.1 Matrix Operations.
Linear Algebra Lecture 38.
3.5 Perform Basic Matrix Operations
Math review - scalars, vectors, and matrices
Game Programming Algorithms and Techniques
Presentation transcript:

Computer Graphics Mathematical Fundamentals Lecture 10 Taqdees A. Siddiqi

Matrices and Simple Matrix Operations In many fields matrices are used to represent objects and operations on those objects.

What a Matrix is? Dimensions of a Matrix Elements of a Matrix Matrix Addition Zero Matrix Matrix Negation Matrix Subtraction Scalar multiplication of a matrix The transpose of a matrix Topics

A matrix is a collection of numbers arranged into a fixed number of rows and columns. Definition

Example Col 1 Row 1 rows X columns

Element Each number that makes up a matrix is called an element of the matrix. The elements in a matrix have specific locations.

Matrix Dimensions The numbers of rows and columns of a matrix are called its dimensions. Here is a matrix with three rows and two columns: (a 3 x 2 matrix)

4 x 1 matrix 2 x 3 matrix

Question: What do you think, a square matrix is? Here is an example: Answer: A matrix with the number of Rows == Columns

Square Matrix In a square matrix the number of rows equals the number of columns. In computer graphics, square matrices are used for transformations.

Column Matrix Row Matrix Column Vector and Row Vector

Question: What are square matrices used for? Answer: Square matrices are used (in computer graphics) to represent geometric transformations.

Names for Matrices Usually a capital letter in bold face, like A or M. Sometimes as a reminder the dimensions are written to the right of the letter, as in B 3x3.

Elements of a matrix

Question: (Thought Question:) If two matrices contain the same numbers as elements, are the two matrices equal to each other? Answer: No, to be equal, two matrices must have the same dimensions, and must have the same values in the same positions.

Matrix Equality For two matrices to be equal, they must have: 1. The same dimensions. 2.Corresponding elements must be equal

In other words, say that A n x m = [a ij ] and that B p x q = [b ij ] Then A = B if and only if n=p, m=q, and a ij =b ij for all i and j in range.

Matrix Addition Order If A is an MxN matrix, and B is also an MxN matrix, then their sum is an MxN matrix formed by adding corresponding elements of A and B

Example

Zero Matrix A zero matrix is one; which has all its elements zero. Here is a 3x3 zero matrix

Question: What would be the result of above addition? Answer: Of course, the sum is the same as the non-zero matrix.

Rules for Matrix Addition A + B = B + A A + 0 = 0 + A = A = 0

Question: Do you think that (A + B) + C = A + (B + C) Answer: Yes — this is another rule that works like real number math.

Multiplication of a Matrix by a Scalar To multiply a matrix by a scalar, multiply each element of the matrix by the scalar. Here is an example of this. (In this example, the variable a is a scalar.)

Negative of a Matrix The negation of a matrix is formed by negating each element of the matrix: -A = -1A Example

Matrix Subtraction If A and B have the same number of rows and columns, then A - B is defined as A + (-B). Usually you think of this as: To form A - B, from each element of A subtract the corresponding element of B.

Example

Transpose The transpose of a matrix is a new matrix whose rows are the columns of the original (which makes its columns the rows of the original).

Example

A Rule for Transpose If a transposed matrix is itself transposed, you get the original back: This illustrates the rule (A T ) T = A.

Question: What is the transpose of: Answer:

Rule Summary

Vectors Another important mathematical concept used in graphics is the Vector If P 1 = (x 1, y 1, z 1 ) is the starting point and P 2 = (x 2, y 2, z 2 ) is the ending point, then the vector V = (x 2 – x 1, y 2 – y 1, z 2 – z 1 )

and if P 2 = (x 2, y 2, z 2 ) is the starting point and P1 = (x 1, y 1, z 1 ) is the ending point, then the vector V = (x 1 – x 2, y 1 – y 2, z 1 – z 2 )

This just defines length and direction, but not position

Vector Projections Projection of v onto the x-axis

Projection of v onto the xz plane

2D Magnitude and Direction The magnitude (length) of a vector: |V| = sqrt( V x 2 + V y 2 ) Derived from the Pythagorean theorem The direction of a vector:  = tan -1 (V y / V x ) a.k.a. arctan or atan atan vs. atan2  is angular displacement from the x-axis

3D Magnitude and Direction 3D magnitude is a simple extension of 2D |V| = sqrt( V x 2 + V y 2 + V z 2 ) 3D direction is a bit harder than in 2D –Need 2 angles to fully describe direction Latitude/longitude is a real-world example

–Direction Cosines are often used: , , and  are the positive angles that the vector makes with each of the positive coordinate axes x, y, and z, respectively cos  = V x / |V| cos  = V y / |V|cos  = V z / |V|

Vector Normalization “Normalizing” a vector means shrinking or stretching it so its magnitude is 1 –a.k.a. creating unit vectors –Note that this does not change the direction Normalize by dividing by its magnitude; V = (1, 2, 3) |V| = sqrt( ) = sqrt(14) = 3.74

Vector Normalization V norm = V / |V| = (1, 2, 3) / 3.74 = (1 / 3.74, 2 / 3.74, 3 / 3.74) = (.27,.53,.80) |V norm | = sqrt( ) = sqrt(.9 ) =.95 Note that the last calculation doesn’t come out to exactly 1. This is because of the error introduced by using only 2 decimal places in the calculations above.

Vector Addition Equation: V 3 = V 1 + V 2 = (V 1x + V 2x, V 1y + V 2y, V 1z + V 2z ) Visually:

Vector Subtraction Equation: V 3 = V 1 - V 2 = (V 1x - V 2x, V 1y - V 2y, V 1z - V 2z ) Visually:

Dot Product The dot product of 2 vectors is a scalar V 1. V 2 = (V 1x V 2x ) + (V 1y V 2y ) + (V 1z V 2z ) Or, perhaps more importantly for graphics: V 1. V 2 = |V 1 | |V 2 | cos(  ) where  is the angle between the 2 vectors and  is in the range 0    

Why is dot product important for graphics? –It is zero iff the 2 vectors are perpendicular cos(90) = 0

The Dot Product computation can be simplified when it is known that the vectors are unit vectors V 1. V 2 = cos(  ) because |V 1 | and |V 2 | are both 1 –Saves 6 squares, 4 additions, and 2 square roots

Cross Product The cross product of 2 vectors is a vector V 1 x V 2 = ( V 1y V 2z - V 1z V 2y, V 1z V 2x - V 1x V 2z, V 1x V 2y - V 1y V 2x ) –Note that if you are into linear algebra there is also a way to do the cross product calculation using matrices and determinants

Again, just as with the dot product, there is a more graphical definition: V 1 x V 2 = u |V 1 | |V 2 | sin(  ) where  is the angle between the 2 vectors and  is in the range 0     and u is the unit vector that is perpendicular to both vectors –Why u? |V 1 | |V 2 | sin(  ) produces a scalar and the result needs to be a vector

The direction of u is determined by the right hand rule –The perpendicular definition leaves an ambiguity in terms of the direction of u Note that you can’t take the cross product of 2 vectors that are parallel to each other –sin(0) = sin(180) = 0  produces the vector (0, 0, 0)

Forming Coordinate Systems Cross products are great for forming coordinate system frames (3 vectors that are perpendicular to each other) from 2 random vectors –Cross V 1 and V 2 to form V 3 –V 3 is now perpendicular to both V 1 and V 2 –Cross V 2 and V 3 to form V 4 –V 4 is now perpendicular to both V 2 and V 3 –Then V 2, V 4, and V 3 form your new frame

V 1 and V 2 are in the new xy plane

Computer Graphics Mathematical Fundamentals Lecture 10 Taqdees A. Siddiqi