The university did not learn linear algebra, but can only review again.
Recommend a book "3D mathematical foundation: the graphics and game development."
Article Directory
vector
Mathematical definition
For mathematicians, the vector is a list of numbers, for programmers is another similar concept - Array
Vector and scalar
Distinguish between vector and scalar mathematics, "speed" and "displacement" is a vector, and the "rate" and "length" is a scalar.
Vector dimension
Dimension vector is the number of "several" of the vector contained, one-dimensional, two-dimensional, three-dimensional, four-dimensional vector. Respectively represent the following figures:
FIG. 4
Represents a scaling factor, image rendering in OpenGL
Position and displacement
Vector has no position, only the size and orientation.
E.g:
- Displacement: "take three steps forward", this sentence is about the location of sounds, but in fact the amount used in a sentence indicates the relative displacement, rather than absolute position. The size of the relative displacement consists of (three steps) and the direction (forward), so it can be represented by a vector.
- Speed: "We traveling north at a speed of 50 mph," which phrase describes a quantity which the size (50 mph) and a direction (north), but no specific position. "50 mph speed north" vector can be expressed.
Note: displacement, velocity and distance, the rate is completely different definitions. Displacement and velocity are vectors comprising the direction and the distance and speed are scalars, do not specify any direction.
So, remember: the vector diagram, only the length and direction of the arrow is significant, it does not include a location.
Vector operations
Negative vector
Negative amount, the original vector and to obtain an equal and opposite vector
Algorithm:
-[x,y] = [-x,-y]
-[x,y,z] = [-x,-y,-z]
-[x,y,z,w] = [-x,-y,-z,-w]
…
向量大小
运算法则
加法
向量a和向量b相加的几何解释为,平移向量,使得向量a的头指向向量b的尾,接着从a的尾向b的头画一个向量。这就是向量加法的“三角形法则”。
点乘
从上述公式中可以看出,点乘满足交换率。
点乘是得到的标量,并满足交换律,所以我们在OpenGL中需要矩阵效果叠加不能使用点乘。
几何解释
点乘等于向量大小与向量夹角的cos值的乘积
Vector Projection
The angle made above, according to the projection point can be calculated by
Vector cross product
The resulting cross product is a vector perpendicular to the original two vectors, referred to as the normal vector
FIG., A, b in a plane, point directly above the plane, perpendicular to the a and b
By parallelogram composition square calculation section cut out
if a, b in parallel or any one of 0,
, so the definition of the zero vector cross product is: it is parallel to any other vector.
verified
perpendicular to a, b, but perpendicular to the a, b has two directions, how to determine? By connecting a head and tail of b, and checks clockwise or counterclockwise from a to b, you will be able to determine the direction of a normal line.
In the left-handed coordinate system, if a and b in a clockwise, then the normal vector pointing you if a and b were counter-clockwise, then the normal vector away from you.
In the right-handed coordinate system, if a and b anticlockwise, then the normal vector point you, if a and b on a clockwise, then the normal vector away from you.