WebGL study notes (b): WebGL coordinate system and basic geometric concepts

WebGL using an orthogonal right-handed coordinate system, and the interval value may be used in each direction beyond the image of the rectangular section not drawn:

  • -1 leftmost x-axis, the rightmost 1;
  • most below the y-axis is -1, 1 is uppermost;
  • z-axis direction toward the maximum value 1 you, you a direction away from a maximum value of 1;

Note: These values ​​are independent of the size of the Canvas, Canvas regardless of the aspect ratio is the number of interval values ​​are consistent WebGL.

Figure:

vector

Dot product

p1.x * p2.x + p1.y * p2.y + p1.z * p2.z

Components of the two vectors and then multiplying by the result of the addition, the angle of the correlation result and the two vectors; dot product of two vectors is 0, the angle between the two vectors is 90 degrees, i.e., perpendicular to each other or orthogonal, when greater than 0, represents an angle less than 90 degrees, less than 0, it represents an angle greater than 90 degrees;

Cross product

After the result is not a scalar multiplication of the cross, but a new vector, and means for calculating the result vector perpendicular to the plane of the cross product of two vectors is located; i.e., the vector triangle normal vector of the plane;

Homogeneous coordinates

We point represents a vector or 3 dimensional space, typically containing 3 to represent Vector3 component, and is more homogeneous coordinate the introduction of a component;

The reason why the introduction of a multi-component, is more convenient for operation in the affine transformation, a more specific explanation see the following articles:

https://www.cnblogs.com/csyisong/archive/2008/12/09/1351372.html

https://blog.csdn.net/janestar/article/details/44244849

matrix

In 3D, the 4x4 matrix is ​​generally used.

Multiplied

Matrix multiplication is a very important operation in 3D graphics, moving both in 3D, rotate or scale or small, are based on the current matrix by multiplying a new matrix to achieve their goals.

Matrix

Can be understood as a constant 1, any matrix multiplication in matrix are unchanged.

Inverse matrix

Inverse matrix can be understood as the inverse of that of the current matrix multiplication result of its inverse matrix is ​​the identity matrix, note that only square (equal to the number of ranks) have inverse matrix, but not all have the inverse square matrix.

One reason for introducing the inverse matrix is ​​used to achieve the division. For example, there matrix X, A, B, wherein X * A = B, we require the value of the X matrix. Instinctively, we only need to B / A can get the X matrix. But for the matrix, the concept of direct division does not exist. We need the help of the inverse matrix, indirectly division matrix. Specific approach is in the same position on both sides of the equation is multiplied by the matrix while the inverse matrix A, as shown below, X * A * (inverse matrix A) = B * (inverse of matrix A). Since A * (inverse matrix A) = I, i.e. matrix, the result of any matrix by matrix are themselves. So, we can get X = B * (inverse matrix A).

Transposed matrix

It means a transposed matrix of the matrix after interchanging rows and columns, and are commonly used in normal inverse matrix transformation.

Affine transformation

Affine transformation matrix contains mainly includes translation, rotation and scaling.

Guess you like

Origin www.cnblogs.com/hammerc/p/11197000.html
Recommended