代写代考 CM0304 Graphics I Graphics Hardware I.1 Graphics Systems

CM0304 Graphics I Graphics Hardware I.1 Graphics Systems

CMT107 Visual Computing

Copyright By PowCoder代写 加微信 powcoder

I.3 Vectors and Matrices

Xianfang Sun

School of Computer Science & Informatics
Cardiff University

• Vector Operations
• Vector Geometry
• Vector Projection

➢ 3D Vectors
• Cross Product
• 3D Vector Geometry

➢ Matrices
• Special Matrices
• Matrix Operations
• Determinant

2:59 PM 2CM3114 Graphics

2:59 PM 3CM3114 Graphics

➢ A vector is a directed line segment, characterised by:
• Direction
• But NOT Position

➢ A vector with length 0 is a zero vector, denoted by 0

• Zero vectors doesn’t have direction.

➢ A vector with length 1 is a unit vector.

➢ A vector u with the same length but opposite direction of

vector v is the negative vector of v, denoted by u = -v.

➢ Two vectors are equal iff they have the same length

and the same direction.

• Two zero vectors are always equal, though their directions are
undefined.

Vector Operations

2:59 PM 4CM3114 Graphics

➢ A vector u multiplied by a scalar  denoted by u has the
same direction of u if  >0 and the opposite direction if
 <0. The length of u is || times of the length of u. ➢ The sum w of two vectors u and v: follows the head-to-tail rule. That is, if the head of u is connected to the tail of v, then w is the directed line segment from the tail of u to the head of v. ➢ The subtraction of vector v from vector w is the addition of vector w and vector -v u = w – v = w + (-v) Vector Operations 2:59 PM 5CM3114 Graphics ➢ A nD vector is represented by: ➢ The sum and subtraction of two vectors are: ➢ The multiplication of a vector v by a scalar  is defined by ➢ The inner product (dot product, scalar product) of two vectors is: vuvuvu +++==  Vector Geometry 3:01 PM 6CM3114 Graphics ➢ A vector has direction and length. • The length is defined by • The direction is parallel to the direction from the origin to the point in nD Euclidean space. • The angle  between two vectors u and v is calculated ➢ Normalisation of a vector v gives a unit vector v’, which has length 1: ➢Vectors u and v are orthogonal if , which means that they are perpendicular to each other, and the angle between these two vectors are 90. vvv +++== vvv Vector Projection 3:01 PM 7CM3114 Graphics ➢The vector projection wp of a vector w on a nonzero vector v is a vector parallel to v, defined by where  is a scalar calculated by ➢The vector w then can be represented by the sum of wp and vector u, which is perpendicular to v (and wp ). Cross Product 3:01 PM 8CM3114 Graphics ➢ Denote two 3D vectors and by , the vector product (also called cross product, outer product) of and is defined by ➢ If  is the angle between and , then the length is: ➢ The direction satisfies right-hand rule • is perpendicular to both zyx ],,[=v http://en.wikipedia.org/wiki/File:Right_hand_rule_cross_product.svg http://en.wikipedia.org/wiki/File:Right_hand_rule_cross_product.svg 3D Vector Geometry 3:01 PM 9CM3114 Graphics ➢ A point in 3D space can be represented by a 3D vector: ➢ A directed line segment from to can be represented by vector: ➢ Let and are two directed line segments on a plane, then the normal direction is determined by the cross product of and : 3:01 PM 10CM3114 Graphics ➢ A matrix is a rectangular array of scalars, arranged in rows and columns. The individual items in a matrix are called its elements or entries. The number of rows and columns are referred to as the row and column dimensions. ➢ The following matrix A has row dimension m and column dimension n, or simply, m x n dimension. aij is an element of the matrix ➢ The transpose of an m x n matrix A, denoted by AT, is the n x m matrix obtained by interchanging the rows and columns of A. ➢ To save the space, the matrix is often written as A = [aij]mxn, or simply, A = [aij], if the dimension of the matrix is implicitly known. Special Matrices 3:01 PM 11CM3114 Graphics ➢ A square matrix is a matrix which has the same row and column dimension. ➢ A symmetric matrix is a square matrix that is equal to its transpose. Let A=[aij] be a symmetric matrix, then A = A T. Its elements satisfy ➢ A diagonal matrix is a matrix (usually square matrix) in which the elements outside the main diagonal are all zero, i.e., A=[aij], ➢ An identity matrix, denoted by I, is a square diagonal matrix with 1’s on the diagonal and 0’s elsewhere = if ,0 otherwise.0 Special Matrices 3:01 PM 12CM3114 Graphics ➢ A row matrix is a matrix of dimension 1 x n. It is also called a row ➢ A column matrix is a matrix of dimension m x 1, also called a column vector. Matrix Operations 3:01 PM 13CM3114 Graphics ➢ Scalar-Matrix multiplication is defined by multiplying each element by the scalar ➢ Matrix-Matrix Addition of two matrices of the same dimension is defined by adding corresponding elements of the two matrices ➢ Matrix-Matrix Multiplication of an m x l dimensional matrix A and an l x n dimensional matrix B is defined by ➢ Inverse of a Square Matrix A is a square matrix B, such that • Denote by B = A-1 ba +=+= BAC Orthogonal Matrix 3:01 PM 14CM3114 Graphics ➢ An orthogonal matrix is a square matrix with real entries whose columns and rows are orthogonal unit vectors (i.e., orthonormal ➢ Equivalently, a matrix Q is orthogonal if its transpose is equal to its inverse: which entails Determinant 3:01 PM 15CM3114 Graphics ➢ The determinant is a value associated with a square matrix, denoted by det(A), det A, or |A|. It is defined as • where Aij is the (i, j) minor matrix of A, which is obtained by deleting the ith row and the jth column of A. ➢ The determinant of a 2 x 2 matrix is calculated by ➢ The determinant of a 3 x 3 matrix is calculated by 312213332112322311322113312312332211 11131312121111 aaaaaaaaaaaaaaaaaa +−=+−== AAAA Cross Product Using Determinant 3:01 PM 16CM3114 Graphics ➢ The cross product of two 3D vectors can be calculated using determinant as follows: 122112211221 yxyxxzxzzyzy 3:01 PM 17CM3114 Graphics ➢ What are the characteristics of a vector? ➢ What operations are defined for vectors. ➢ How to calculate the vector projection onto another vector? ➢ How to calculate cross product? What is the geometric meaning of cross product? ➢ How to do matrix operations? ➢ What is a orthogonal matrix? ➢ How to calculate determinant? 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com