Vector to add and subtract

  • In space: when you subtract,a minus b ends up pointing to a
  • Numerically: add and subtract directly

Matrix multiplication

  • Numerically, the first matrix determines the number of rows, and the second matrix determines the number of columns, so as to obtain a new matrix. The second matrix has little relationship with the columns
  • In space: the former matrix is the new tensor space, and the latter one is the coordinates of the 0,0,0 tensor space

Composite matrix

  • Spatially: The action of twice tensor Spaces
  • Numerically: in the figure below, the next two columns are the coordinates of the 0,0 tensor space

Inverse matrix

  • Not all inverses are like this

rank

  • If the tensor space is on a line, the rank is one
  • If the tensor space is in a plane, the rank is two
  • If the tensor space is in three dimensions, the rank is three

The dot product

  • Numerically, two one-column vectors are multiplied and added together;
  • Space: | a | b | | cos the another Angle;

cross-product

  • The physical meaning is to get the area, also get the third vector,

Scaling matrix

  • Because it directly affects the values of the coordinates,k1 affects X, K2 affects Y, and k3 affects Z
  • The scale matrix is a diagonal matrix, and the transpose of the scale matrix is equal to itself
  • The inverse of the scaling matrix is the inverse of the numbers

Rotation matrix

By definition, rotationAngle and rotationThe angles are reciprocal, that is: 。

Therefore, for the rotation transformation, it can be concluded that the inverse of the rotation matrix is equal to its transpose, namely:

 

  • Because the transpose is a little bit easier to use than the inverse. So I want to figure this out
  • RT to the minus 1 is R the inverse of the transpose of the rotation matrix is equal to the rotation matrix

Orthogonal matrix

  • Orthogonal matrices are matrices whose transposes are equal to their inverse.

Transpose and inverse

  • We can set up the equation like this

The model of matrix

  • Model matrix formed by scaling, rotation and migration
  • If you have a model and you want to go back to the center, you have to translate, rotate, scale

Camera perspective matrix and orthogonal matrix

  • Orthogonal matrix: The last number is 1, the fourth column has (because of the offset), the third column has the last 0
  • Perspective matrix: the last number is 0, the fourth column has only the third row (just offset the z-axis), and the last one of the third column is 1
  • So if you know z at the viewport coordinates, you get w
float clipW = cameraProjectionMatrix[2] [3] * viewZ + cameraProjectionMatrix[3] [3];
Copy the code

Uniform Matrices are written vertically

  • This is the perspective projection matrix

Two unit vector orthogonalization, Gram-Schmidt orthogonalization

Compute the reflection vector R with N and V unit vectors

vec3 R = normalize((2.0 * NoV ) * N - V);
Copy the code

Local coordinates and world coordinates

  • The world coordinate is the parent coordinate
  • Local coordinates are relative to parent coordinates