Basis:
Subscript: The first subscript is the index of the row where the element is located, and the second subscript is the index of the column that contains the element. As shown
Row and column vectors: a single-line vector is called a row vector, and only a single column is called a columns vector.
Equal
Dimensions and elements are equal
Multiplication (multiplied by scalar)
Multiply each element with a scalar
Addition (Matrix + matrix = matrix)
Two matrix the corresponding elements of the matrix to be added, must be of equal dimensions
Matrix multiplication (Matrix * matrix = matrix)
Condition: The number of columns of a must be equal to the number of rows in B
Definition: A (m*n) B (n*p) The product AB is meaningful, and equals a matrix C (m*p), where the product c[i][j] = The first line of a vector * B of the dot product of the J column vector.
The unit matrix (similar to scalar 1 multiplied by the matrix does not change the matrix)
Definition: Except the main diagonal element is 1, the others are all 0
The unit array can be used as a multiplication unit (multiplicative identity) MI = IM = M
That is, a single matrix is multiplied with a matrix, and the matrix is not changed. Moreover, a matrix is multiplied by the unit matrix, which is a special case of matrix concise and exchangeable, and the unit matrix is considered as "1" in the Matrix for scalars.
Prove:
Inverse matrix (multiplication of matrices inverse)
- Only the phalanx has the inverse matrix.
- The inverse matrix of a n*n matrix M is also a n*n matrix with representations
- Not all matrices have inverse matrices.
- The product of a matrix and its inverse array is a unit array, which can be exchanged when a matrix is multiplied by its inverse matrix.
D3DX Matrix
When programming D3DX programs, we usually only use the 4*4 matrix and the 1*4 line vectors. Note that using both of these maintenance matrices means that the following matrix multiplication is meaningful:
Vector-matrix multiplication. If V is a line vector of 1*4, T is a matrix of 4*4, then the product VT is meaningful, and the result is a line vector of 1*4
Matrix multiplication: If T and R are 4*4 matrices, then the product TR and RT are meaningful, and the result is a matrix of 4*4. Note that TR and RT are not necessarily equal.
Basic transformations
1*4 vector in 3d coordinate system midpoint means P = (p1,p2,p3,0)
1*4 vector representation of vectors in a 3d coordinate system V = (v1,v2,v3,1) The extended vector is called the homogeneous vector, because the homogeneous vector can represent a point and can represent a vector
Vector is in homogeneous space:
Translation matrix
To move the vector (x,y,z,1) along the x-axis in px units, the y-axis translates the PY units, and the z-axis shifts the PZ units we just need to multiply the vector with the following matrix
The D3DX function used to create the translation matrix is d3dxmatrixtranslation
Rotation matrix
We can use the following 3 matrices to represent the rotation of θ around the x, Y, Z axis
The inverse matrix of the rotation matrix R is equal to its transpose, i.e.
Matrix with proportional variation
Proportional change of
If you let a vector magnify qx,qy,qz times along the x, Y, Z axis, you can multiply the vector by the following matrix
The functions in DX are
A combination of geometric changes
One of the most important advantages of matrix transformation is that several transformations can be combined into one transformation matrix with matrix multiplication
Some functions of vector transformation
The D3dxverc3transformcoord function transforms a point and assumes that the 4th component of the vector is 1
D3dxvec3transformnormal is used for vector transformations and assumes the 4th component of a vector is 0
The Matrix in 3d