1 3D Vector & Matrix Chapter 2. 2 Vector Definition: Vector is a line segment that has the direction. The length of the line segment is called the magnitude.

Slides:



Advertisements
Similar presentations
Points, Vectors, Lines, Spheres and Matrices
Advertisements

Determinant The numerical value of a square array of numbers that can be used to solve systems of equations with matrices. Second-Order Determinant (of.
Linear Algebra.
Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1 : “shiv rpi” Linear Algebra A gentle introduction Linear Algebra has become as basic and as applicable.
Chapter 4.1 Mathematical Concepts
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
Matrices. Special Matrices Matrix Addition and Subtraction Example.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
3-D Geometry.
Lecture # 9 Matrix Representation of Symmetry Groups
Ch 7.2: Review of Matrices For theoretical and computation reasons, we review results of matrix theory in this section and the next. A matrix A is an m.
Lesson 4 Review of Vectors and Matrices. Vectors A vector is normally expressed as or in terms of unit vectors likewise.
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
Week 4 - Monday.  What did we talk about last time?  Vectors.
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.
1 Matrix Math ©Anthony Steed Overview n To revise Vectors Matrices n New stuff Homogenous co-ordinates 3D transformations as matrices.
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
Patrick Nichols Thursday, September 18, Linear Algebra Review.
Chapter 4.1 Mathematical Concepts
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
H.Melikyan/12001 Vectors Dr.Hayk Melikyan Departmen of Mathematics and CS
A rectangular array of numbers (we will concentrate on real numbers). A nxm matrix has ‘n’ rows and ‘m’ columns What is a matrix? First column First row.
CMPS 1371 Introduction to Computing for Engineers MATRICES.
Overview Definitions Basic matrix operations (+, -, x) Determinants and inverses.
Algebra 3: Section 5.5 Objectives of this Section Find the Sum and Difference of Two Matrices Find Scalar Multiples of a Matrix Find the Product of Two.
Matrices. Definitions  A matrix is an m x n array of scalars, arranged conceptually as m rows and n columns.  m is referred to as the row dimension.
Matrices, Transformations and the 3D Pipeline Matthew Rusch Paul Keet.
6.837 Linear Algebra Review Rob Jagnow Monday, September 20, 2004.
Magnitude of a Vector The magnitude of a vector, denoted as |a|, is defined as the square root of the sum of the squares of its components: |a| = (x 2.
Introduction to Matrices and Vectors Sebastian van Delden USC Upstate
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Matthew Christian. About Me Introduction to Linear Algebra Vectors Matrices Quaternions Links.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
Meeting 18 Matrix Operations. Matrix If A is an m x n matrix - that is, a matrix with m rows and n columns – then the scalar entry in the i th row and.
Chapter 8 Matrices and Determinants Matrix Solutions to Linear Systems.
1 Graphics CSCI 343, Fall 2015 Lecture 10 Coordinate Transformations.
Chun-Yuan Lin Mathematics for Computer Graphics 2015/12/15 1 CG.
Composite 3D Transformations. Example of Composite 3D Transformations Try to transform the line segments P 1 P 2 and P 1 P 3 from their start position.
MATRICES Operations with Matrices Properties of Matrix Operations
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Honors Geometry.  We learned how to set up a polygon / vertex matrix  We learned how to add matrices  We learned how to multiply matrices.
2.5 – Determinants and Multiplicative Inverses of Matrices.
Composite 3D Transformations. Example of Composite 3D Transformations Try to transform the line segments P 1 P 2 and P 1 P 3 from their start position.
 An image is the new figure, and the preimage is the original figure  Transformations-move or change a figure in some way to produce an image.
CS 450: COMPUTER GRAPHICS TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
Linear Algebra Review Tuesday, September 7, 2010.
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry "Old Henry And His Old Aunt" Defined using right triangle  x y h.
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.
CHAPTER 3 VECTORS NHAA/IMK/UNIMAP.
MTH108 Business Math I Lecture 20.
Math Fundamentals Maths revisit.
Matrix Operations SpringSemester 2017.
Vectors Jeff Chastine.
Scalars and Vectors.
With an immediate use for it
4-4 Geometric Transformations with Matrices
Transformation Operators
Basics of Linear Algebra
Linear Algebra A gentle introduction
Math review - scalars, vectors, and matrices
Matrix Operations SpringSemester 2017.
Game Programming Algorithms and Techniques
CHAPTER 3 VECTORS NHAA/IMK/UNIMAP.
Presentation transcript:

1 3D Vector & Matrix Chapter 2

2 Vector Definition: Vector is a line segment that has the direction. The length of the line segment is called the magnitude or size of the vector. If two vectors have the same magnitude and direction, then they are considered as the same vectors

3 Vector3(float, float, float) 3D DirectX has class public Vector3 ( float valueX, float valueY, float valueZ ) If we set the beginning point of a vector at origin, then the ending point of the vector is uniquely defined. Therefore we can use vector to define a point, like vertex.

4 Addition of Vector3 We can directly use + to add two vectors.

5 Subtraction of Vector3 We can directly use  to subtract two vectors.

6 Dot Product of Vector3 static float Dot ( Vector3 left, Vector3 right ) If Vector3 v1 = new Vector3(a1, b1, c1); And Vector3 v2 = new Vector3(a2, b2, c2); Then v1 o v2 = a1×a2 + b1×b2 + c1×c2

7 Cross Product of Vector3 static Vector3 Cross( Vector3 left, Vector3 right ) 

8 Other methods of Vector3 float Length( ) Return the length of the vector Vector3 Normalize( ) Return the vector that has the same direction and length=1 Vector3 Multiply(float ) We can directly use  to multiply a vector by a float number

9 3D Matrix An array of floats that represent a 4 x 4 matrix, where i is the row number and j is the column number. For example, M34 means the component in the third row and fourth column struct Matrix{ float M11, M12, M13, M14; float M21, M22, M23, M24; float M31, M32, M33, M34; float M41, M42, M43, M44; };

10 Matrix Properties Call Matrix.Identity to get an identity matrix. float Determinant { get; } static Matrix Identity { get; } static Matrix Zero{ get; } Call Matrix.Zero to get an empty matrix.

11 Matrix Rotation Methods Call Matrix.RotationX to get a matrix that represents the rotation about x-axis by angle  static Matrix RotationX (float  ) static Matrix RotationY (float  ) static Matrix RotationZ (float  ) static Matrix RotationAxis(Vector3 axis, float  ) Get a rotation matrix about any axis

12 Actually,

13 Matrix Translation Methods This is the operation (x, y, z)  (x+a, y+b, z+c) The matrix is static Matrix Translation( float a,float b,float c) static Matrix Translation(Vector3 v) Because that

14 Matrix Transpose Method If we have matrix static Matrix Transpose(Matrix m) Then its transpose matrix is

15 Matrix Inverse Method Matrix Invert() static Matrix Invert(Matrix m ) Let If A*B = I (identity matrix), then B is call the inverse matrix of A. Also A is the inverse matrix of B.

16 Matrix operator Method Matrix has +, , * operators static Matrix operator + ( Matrix m1, Matrix m2) Which means they can directly do operations static Matrix operator - ( Matrix m1, Matrix m2) static Matrix operator * ( Matrix m1, Matrix m2) Matrix m1, m2; Matrix m_sum = m1 + m2; Matrix m_minus = m1 - m2; Matrix m_product = m1* m2;

17 World Coordinate Every Matrix object is a transformation of the 3D space. The following is the code to set this transformation. In the above, the world coordinate of Figure 1 could also under transformation by Matrix m1; Matrix m1, m2; m_device.Transform.World = Matrix.Identity(); Draw Figure 1; // under transformation m1 m_device.Transform.World = m1; Draw Figure 2; // under transformation m1 Draw Figure 3; // under transformation m1 m_device.Transform.World = m2; Draw Figure 4; // under transformation m2 only

18 Matrix combination We have two transformations whose matrices are m1 and m2. If applying those two transformations consecutively to our 3D world, we need to do Matrix multiplication. In 3D program the left matrix takes action first. (In Mathematics, the right one takes action first.) Matrix matRotation, matTranslation; m_device.Transform.World = matTranslation* matRotation ; Draw Figure; // first translation then rotation