GAMES103: Introduction to Physics-Based Computer Animation
Link: GAMES103
1. Division of coordinate system
The game engine is divided into right-handed and left-handed coordinate systems. What is the basis for the distinction?
As you can see from the picture above, if it is a left-handed coordinate system, then all objects are behind the screen, which means that the values of x, y, and z are all positive.
2. Vector Norm
The length of a vector is 2-Norm
, Vector Norm is usually used to evaluate vectors.
3. Projection
From the calculation of projection, we can see that the length of the projection is only related to two vectors.
In game engines, the Signed Distance derived from projection is usually used to determine collision detection.
4. Cross product
4.1 Topological order of triangles
The cross product determines the direction of calculation of two sides, so when entering a triangle, you should also pay attention to the order of the triangle sides, also called topological order.
4.2 Signed Areas和Barycentric Weights
For 2 dimensions, the cross product leads to the centroid interpolation.
For 3 dimensions, the volume can be calculated by cross product, and the cross product also has the same rule.
5. Decomposition of matrix
5.1 Singular value decomposition
The main idea of the singular value decomposition of a matrix is that each matrix can be 旋转→缩放→旋转
obtained through a formal step.
Therefore, U and V are both orthogonal matrices, used for rotation operations, and D is a diagonal matrix, used for scaling. The values in D are also called singular values.
5.2 Eigenvalue decomposition
Note: In computer physics, eigenvalue decomposition of symmetric matrices is mainly discussed.
The idea of eigenvalues: specified scaling for each "axis".
5.3 LU decomposition
The idea of LU decomposition: Any matrix can be decomposed into the product of upper triangular and lower triangular matrices, which is mainly used to solve Ax=b
linear equations.
6. Positive definite matrix
The usual method of determining the positive definiteness of a matrix:
(1) Determine the positivity or negativity of the eigenvalues
(2) Use the diagonal dominance method to determine the positive definiteness. Note that diagonal dominance can lead to positive definiteness, but positive definiteness does not necessarily mean diagonal dominance
(3 ) A positive definite matrix must be invertible
7. Iterative method to solve linear systems
Main purpose: make b − A x [ k ] b-Ax^{[k]}b−Ax[ k ] approaches 0, which requires1 − 1-1 − α \alphaα AM − 1 AM^{-1}AMThe spectral radius of − 1 is less than 1, so different M matrices correspond to different iteration methods.
The linear system can be considered as a quadratic optimization problem, α \alphaα usually requires trial and error.
Iteration methods are divided into:
(1) Jacobi iteration method
(2) Gauss-Seidel iteration method
(3) Super relaxation (SOR method)
Note: The iterative method will be explained in detail later when used.
8. Derivatives of vectors
8.1 The first derivative of an ordinary function with respect to the vector x
The first derivative of the vector x is usually expressed as a gradient, which means the fastest growth direction.
8.2 Find the first derivative of a vector function with respect to vector x
The vector function is equivalent to a vector composed of three functions, which can be directly derived.
In the above figure, Jacobian is the Jacobian and Divergence is the divergence. If ▽ \bigtriangledown▽ can also be regarded as an operator, then doing the cross product will get Curl, which is the curl.
8.3 The second derivative of an ordinary function with respect to the vector x
Second-order derivative, because the first-order derivative of an ordinary function on a vector must be a vector, and derivation again is equivalent to doing Jacobian.
The Hessian (Hessian matrix) is just a combination of the first derivatives, and the diagonal of the same Hessian matrix is called Laplacian (Laplacian).
9. Taylor expansion of functions on vector parameters
Note: The second-order Taylor expansion of a vector can be judged to be positive definite, which can bring many properties, such as extreme values.
10. Force analysis of springs
Through the chain rule and the laws of physics we can derive the energy, force and energy Hessian matrix of the spring when it is stressed.
10.1 Derivation of Norm with respect to x
10.2 One-way spring force
10.3 Bidirectional spring force
When there are forces in both directions, we combine the forces at both ends into one large vector and calculate it in the same way.