Audio and video study notes - Vector understanding

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/shengpeng3344/article/details/91450197

The university did not learn linear algebra, but can only review again.
Recommend a book "3D mathematical foundation: the graphics and game development."

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:
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
FIG. 4 C w C_w 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.
    Here Insert Picture Description
    So, remember: the vector diagram, only the length and direction of the arrow is significant, it does not include a location.

Vector operations

Here Insert Picture Description

Negative vector

Negative amount, the original vector and to obtain an equal and opposite vector
Here Insert Picture Description

Algorithm:

-[x,y] = [-x,-y]
-[x,y,z] = [-x,-y,-z]
-[x,y,z,w] = [-x,-y,-z,-w]

向量大小

Here Insert Picture Description

运算法则

加法

Here Insert Picture Description
向量a和向量b相加的几何解释为,平移向量,使得向量a的头指向向量b的尾,接着从a的尾向b的头画一个向量。这就是向量加法的“三角形法则”。
Here Insert Picture Description

点乘

a b = a x b x + a y b y ( a b 2 D ) a\cdot b = a_x b_x + a_y b_y (a和b是2D向量)
a b = a x b x + a y b y + a z b z ( a b 3 D ) a\cdot b = a_x b_x + a_y b_y + a_z b_z(a和b是3D向量) Here Insert Picture Description
从上述公式中可以看出,点乘满足交换率。
点乘是得到的标量,并满足交换律,所以我们在OpenGL中需要矩阵效果叠加不能使用点乘。

几何解释

Here Insert Picture Description
点乘等于向量大小与向量夹角的cos值的乘积

a b = a b cos θ a·b =|a||b|\cos \theta

Vector Projection

The angle made above, according to the projection point can be calculated by
Here Insert Picture Description

Vector cross product

The resulting cross product is a vector perpendicular to the original two vectors, referred to as the normal vector

Here Insert Picture Description

FIG., A, b in a plane, a × b a \times b point directly above the plane, perpendicular to the a and b

Here Insert Picture Description

Here Insert Picture Description
By parallelogram composition square calculation section cut out
Here Insert Picture Description
if a, b in parallel or any one of 0, a × b = 0 a \times b = 0 , so the definition of the zero vector cross product is: it is parallel to any other vector.
verified a × b a \times b 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.

Here Insert Picture Description

Guess you like

Origin blog.csdn.net/shengpeng3344/article/details/91450197