TA learning path - 1.2 vector

Mathematical Basics - Detailed Explanation of Vectors

1. What is a vector

In mathematics, a vector (also known as a Euclidean vector, a geometric vector, or a vector) refers to a quantity that has magnitude and direction.

2. Vector representation

Algebraic representation
Upper and lower case letters + arrows:
A → or b → AB → or ab → \overrightarrow{A}\ \ or \ \ \overrightarrow{b} \ \ \ \ \ \ \overrightarrow{AB}\ \ or \ \ \overrightarrow{ab}A   or  b        AB   or  ab
·Geometric representation
1. Two-dimensional
two dimensional
2. Three-dimensional
insert image description here

Coordinate representation
1. Two-dimensional
Take two unit vectors i and j in the same direction as the x-axis and y-axis respectively as a set of bases. There is and only a pair of real numbers (x, y), so that a=xi+yj, so the pair of real numbers (x, y) is called the coordinates of vector a, denoted as a=(x, y).
A → = ( ​​ax , ay ) , B → = ( ​​bx , by ) \overrightarrow{A}=(a_x,a_y)\ \ ,\ \ \overrightarrow{B}=(b_x,b_y)A =(ax,ay)  ,  B =(bx,by)
2. Three-dimensional
Take three unit vectors i, j, k in the same direction as the x-axis, y-axis, and z-axis respectively as a set of bases. There is one and only one set of real numbers (x, y, z), so that a=ix+jy+kz, so the pair of real numbers (x, y, z) is called the coordinates of vector a, denoted as a=(x, y, z ).
A → = ( ​​ax , ay , az ) , B → = ( ​​bx , by , bz ) \overrightarrow{A}=(a_x,a_y,a_z)\ \ ,\ \ \overrightarrow{B}=(b_x,b_y, b_z)A =(ax,ay,az)  ,  B =(bx,by,bz)

Matrix representation
1. Two-dimensional
A → = [ axay ] B → = [ bxby ] \overrightarrow{A}= \begin{bmatrix} a_x \\ a_y \end{bmatrix}\ \ \ \overrightarrow{B}= \begin{ bmatrix} b_x \\ b_y \end{bmatrix}A =[axay]   B =[bxby]
2.三维
A → = [ a x a y a z ]     B → = [ b x b y b z ] \overrightarrow{A}= \begin{bmatrix} a_x \\ a_y\\ a_z \end{bmatrix}\ \ \ \overrightarrow{B}= \begin{bmatrix} b_x \\ b_y\\ b_z \end{bmatrix} A =axayaz   B =bxbybz

3. Basic definition of vector

A vector is a directed line segment with magnitude and direction.
A vector has no position, only magnitude and direction
. The arrow of a vector is the end of the vector and the beginning of the vector.
The displacement described by the vector can be considered as a sequence of displacements parallel to the axis

Code:
two dimensional

public struct M_Vector2
{
    
    
    public float x;
    public float y;
    public M_Vector2(float x,float y)
    {
    
    
        this.x = x;
        this.y = y;
    }
}

three dimensional

public struct M_Vector3
{
    
    
    public float x;
    public float y;
    public float z;
    public M_Vector3(float x,float y,float z)
    {
    
    
        this.x = x;
        this.y = y;
        this.z = z;
    }
}

4. Vector operations

设 a → = ( a x , a y )   ,   b → = ( b x , b y ) 设\overrightarrow{a}=(a_x,a_y) \ , \ \overrightarrow{b}=(b_x,b_y) set upa =(ax,ay) , b =(bx,by)
4.1 Addition The addition of vectors
satisfies the parallelogram law and triangle law, OA → + OB → = OC → a = [ axay ] , b = [ bxby ] a + b = [ ax + bxay + by ] = [ ax + bxay + by ] [ 1 1 ] a + 0 = 0 + a commutative law: a + b = b + a associative law: ( a + b ) + c = a + ( b + c ) addition of vectors satisfies parallelogram law and triangle rule, \\ \overrightarrow{OA}+\overrightarrow{OB}=\overrightarrow{OC} \\ \ \\ a= \begin{bmatrix} a_x \\ a_y \end{bmatrix}\ \ , \ \ b= \ begin{bmatrix} b_x \\ b_y \end{bmatrix} \\ \ \\ a + b = \begin{bmatrix} a_x + b_x\\ a_y + b_y \end{bmatrix}= \begin{bmatrix} a_x + b_x\ \ a_y + b_y \end{bmatrix} \begin{bmatrix} 1\\ 1 \end{bmatrix} \\ \ \\ a+0 = 0+ a \\ \ \\ commutative law: a+b=b+a \\ \ \\ Associative law: (a+b)+c=a+(b+c)The addition of vectors satisfies the parallelogram rule and the triangle rule ,OA +OB =OC  a=[axay]  ,  b=[bxby] a+b=[ax+bxay+by]=[ax+bxay+by][11] a+0=0+a commutative law : a+b=b+a Associative law : ( a+b+c=a+(b+c)
Code:
two dimensional

    /// 两个向量相加
    public static M_Vector2 operator+(M_Vector2 m_Vector2_A,M_Vector2 m_Vector2_B)
    {
    
    
        return new M_Vector2(m_Vector2_A.x + m_Vector2_B.x, m_Vector2_A.y + m_Vector2_B.y);
    }

three dimensional

//加法
    public static M_Vector3 operator +(M_Vector3 v3_A,M_Vector3 v3_B)
    {
    
    
        return new M_Vector3(v3_A.x + v3_B.x, v3_A.y + v3_B.y, v3_A.z + v3_B.z);
    }

4.2 Subtraction
If a and b are opposite vectors, then a=-b, b=-a, a+b=0.0, the
inverse quantity is 0.
OA → − OB → = BA → a = ( ax , ay ) , b = ( bx , by ) , a − b = ( ax − bx , ay − by ) . \overrightarrow{OA}-\overrightarrow{OB}= \overrightarrow{BA} \\ \ \\ a=(a_x,a_y), b=(b_x,b_y), \\ \ \\ ab=(a_x-b_x,a_y-b_y).OA OB =BA  a=(ax,ay)b=(bx,by) ab=(axbx,ayby).

Law of addition and subtraction: a+(-b)=ab
Code:
two dimensional

    /// 两个向量相减
    public static M_Vector2 operator -(M_Vector2 m_Vector2_A, M_Vector2 m_Vector2_B)
    {
    
    
        return new M_Vector2(m_Vector2_A.x - m_Vector2_B.x, m_Vector2_A.y - m_Vector2_B.y);
    }

three dimensional

    //减法
    public static M_Vector3 operator -(M_Vector3 v3_A, M_Vector3 v3_B)
    {
    
    
        return new M_Vector3(v3_A.x - v3_B.x, v3_A.y - v3_B.y, v3_A.z - v3_B.z);
    }

4.3 Number
multiplication The product of cross product of real number λ and vector a is a vector, denoted as λa, and |λa|=|λ|*|a|.

When λ>0, the direction of λa is the same as that of a;
when λ<0, the direction of λa is opposite to that of a;
when λ=0, λa=0, the direction is arbitrary.
When a=0, for any real number λ, there is λa=0.

Note:By definition, if λa=0, then λ=0 or a=0.
The real number λ is called the coefficient of the vector a, and the geometric meaning of the multiplier vector λa is to stretch or compress the directed line segment representing the vector a.

When |λ| >1, it means that the directed line segment of vector a is elongated to the original |λ| times in the original direction (λ>0) or in the opposite direction (λ<0).
When |λ|<1, it means that the directed line segment of the vector a is shortened to the original |λ| times in the original direction (λ>0) or the reverse direction (λ<0).

The dot product of a real number p and a vector a is a number.

The multiplication of numbers and vectors satisfies the following
law of operation: associative law: (λa)·b=λ(a·b)=(a·λb).
Distributive law of vectors to numbers (first distributive law): (λ+μ)a=λa+μa.
Distributive law of numbers to vectors (second distributive law): λ(a+b)=λa+λb.

Elimination Law of Number Multiplication Vector:
① If the real number λ≠0 and λa=λb, then a=b.
② If a≠0 and λa=μa, then λ=μ.

Note:The addition, subtraction, and multiplication of vectors (vectors do not have division) operations satisfy the algorithm of addition, subtraction, and multiplication of real numbers.

Code:
two dimensional

    /// 数乘
    public static M_Vector2 operator *(M_Vector2 m_Vector2,float k)
    {
    
    
        return new M_Vector2(m_Vector2.x * k, m_Vector2.y * k);
    }

three dimensional

    //数乘
    public static M_Vector3 operator *(M_Vector3 v3, float lambda)
    {
    
    
        return new M_Vector3(v3.x * lambda, v3.y * lambda, v3.z * lambda);
    }

4.4 Quantitative product
4.4.1 Definition:
The quantitative product (inner product, dot product) of two vectors is a scalar quantity (without direction), denoted as a·b.

Knowing two non-zero vectors a, b, OA=a, OB=b, then ∠AOB is called the angle between vector a and vector b, denoted as θ and stipulated 0≤θ≤π.

If a and b are not collinear, then; if a and b are collinear, then.
The coordinate representation of the quantity product of vectors: a b=x x'+y y'.

4.4.2 Geometric meaning
1. It can be used to calculate the angle between two vectors.
From the dot product formula,
cos θ = a ⋅ b ∣ a ∣ ∣ b ∣ cos \theta = \cfrac {a \cdot b}{\vert a \vert \vert b \vert \ }cosθ=ab ab

    public static float Angle(M_Vector2 from,M_Vector2 to)
    {
    
    
        float denominator = from.Magnitude * to.Magnitude;
        float dot = Dot(from, to) / denominator;
        //Cos弧度值的范围为-1到1
        if(dot < -1)
        {
    
    
            dot = -1;
        }
        else if(dot > 1)
        {
    
    
            dot = 1;
        }
        return (float)Math.Acos(dot) * 180 / Mathf.PI;
    }

2. The projection of vector x in the direction of vector x
For example, the projection S of vector a in the direction of vector b is:
S = a ⋅ b ∣ b ∣ S = \cfrac {a \cdot b}{\vert b \vert}S=bab

    //A向量在B向量方向上的投影
    public static float ProjectMagnitude(M_Vector2 m_Vector2_A, M_Vector2 m_Vector2_B)
    {
    
    
        return Dot(m_Vector2_A,m_Vector2_B) * m_Vector2_B.Magnitude;
    }

Supplement: The projection vector of vector x in the direction of vector x
For example, the projection P of vector a in the direction of vector b is:
P = b ∣ b ∣ ⋅ ∣ a ∣ ⋅ cos θ P = \cfrac {b}{\vert b \ vert} \cdot\vert a \vert \cdot cos \thetaP=bbacosθ

    //A向量在B向量方向上的投影向量
    public static M_Vector2 Project(M_Vector2 m_Vector2_A, M_Vector2 m_Vector2_B)
    {
    
    
        return m_Vector2_B.normalized * m_Vector2_A.Magnitude * (float)Math.Cos(Angle(m_Vector2_A, m_Vector2_B) * 2 * Mathf.PI / 360);
    }

4.4.2 Operation laws of the quantity product of vectors
Commutative law: a·b=b·a
Associative law: (λa)·b=λ(a·b)
Distributive law: (a+b)·c=a·c+ b·c

4.4.3 The nature of the quantitative product of vectors
a·a=|a| squared.
a⊥b<=>a b=0.
|a·b|≤|a|·|b|. (The formula is proved as follows: |a·b|=|a|·|b|·|cosα| Because 0≤|cosα|≤1, so |a·b|≤|a|·|b|)

4.4.4 The main differences between the quantitative product of vectors and real number operations
1. The quantity product of vectors does not satisfy the associative law, namely: (a·b)·c≠a·(b·c); for example: (a·b)²≠a²·b².
2. The quantity product of vectors does not satisfy the law of elimination, that is, b=c cannot be deduced from a·b=a·c(a≠0).
3. |a·b| is not equivalent to |a|·|b|
4. From |a|=|b|, a=b cannot be deduced, and a=-b cannot be deduced, but the reverse is true.
4.4.5 Programming calculation
1. Two-dimensional
a = ( ax , ay ) , b = ( bx , by ) a ⋅ b = [ axay ] [ bxby ] = ax ∗ bx + ay ∗ by = ∣ a ∣ ⋅ ∣ b ∣ ⋅ cos θ a=(a_x,a_y),b=(b_x,b_y) \\ \ \\ a \cdot b= \begin{bmatrix} a _x & a_y \end{bmatrix} \begin{bmatrix} b _x \ \b_y \end{bmatrix} = a_x*b_x + a_y * b_y = \vert a \vert \cdot \vert b \vert \cdot cos \thetaa=(ax,ay),b=(bx,by) ab=[axay][bxby]=axbx+ayby=abcosθ
Code:

    public static float Dot(M_Vector2 m_Vector2_A, M_Vector2 m_Vector2_B)
    {
    
    
        return m_Vector2_A.x * m_Vector2_B.x + m_Vector2_A.y * m_Vector2_B.y;
    }

2.三维
a = ( a x , a y , a z ) , b = ( b x , b y , b z )   a ⋅ b = [ a x a y a z ] [ b x b y b z ] = a x b x + a y b y + a z b z = ∣ a ∣ ⋅ ∣ b ∣   c o s θ a=(a_x,a_y,a_z),b=(b_x,b_y,b_z) \\ \ \\ a \cdot b= \begin{bmatrix} a _x & a_y & a_z \end{bmatrix} \begin{bmatrix} b _x \\ b_y\\ b_z \end{bmatrix} = a_xb_x + a_y b_y + a_zb_z= \vert a \vert \cdot \vert b \vert\ cos \theta a=(ax,ay,az),b=(bx,by,bz) ab=[axayaz]bxbybz=axbx+ayby+azbz=ab cosθ
Code:

    //点积
    public static float Dot(M_Vector3 v3_A,M_Vector3 v3_B)
    {
    
    
        return v3_A.x * v3_B.x + v3_A.y + v3_B.y + v3_A.z + v3_B.z;
    }

4.5 Vector product
4.5.1 Definition:
The vector product (outer product, cross product) of two vectors a and b is a vector, recorded as a×b (here “×” is not a multiplication sign, but a way of expression, and "·"different).
If a and b are not collinear, then the modulus of a×b is: ∣a×b∣=|a|·|b|·sin〈a, b〉; the direction of a×b is: perpendicular to a and b, And a, b and a×b form a right-handed system in this order.
If a and b are perpendicular, then ∣a×b∣=|a|*|b| (this is different from the quantity product, please note), if a×b=0, then a and b are parallel.
The vector product is a set of normal vectors of the plane where two non-collinear non-zero vectors lie.

Algorithm:
Let i, j, k be unit vectors along the x, y, and z axes respectively
A = ( ax , ay , az ), B = ( bx , by , bz ), A=(a_x,a_y,a_z) , B=(b_x,b_y,b_z),A=(ax,ay,az)B=(bx,by,bz
则有
A = a x i + a y j + a z k , B = b x i + b y j + b z k .    A= a_xi+a_yj+a_zk ,\\ B= b_xi+b_yj+b_zk.\ \ A=axi+ayj+azk,B=bxi+byj+bzk .Specify  
the equation
1.Let
a × b = ∣ ijkaxay 0 bxby 0 ∣ = ( axby − bxay ) let \times b = \begin{vmatrix} i & j & k\\ a_x & a_y & 0\ . \ b_x & b_y & 0 \ end { vmatrix } = ( a_x b_y - b_x a_y ) ka×b=iaxbxjaybyk00=(axbybxay)k

则有
∣ a × b ∣ = ∣ a x ∗ b y − b x ∗ a y ∣ = ∣ a ∣ ⋅ ∣ b ∣ ⋅ s i n θ \vert a \times b \vert =\vert a_x * b_y - b_x * a_y \vert = \vert a \vert \cdot \vert b \vert \cdot sin \theta a×b=axbybxay=absinθ

It can be seen from the above that the result direction of the cross product calculated on the x, y plane is on the z axis, which has little practical significance in two dimensions, and most engines do not provide relevant implementation codes.

2.三维
则   A × B = ∣ i j k a x a y a z b x b y b z ∣ = ( a y b z − a z b y ) i − ( a x b z − a z b x ) j + ( a x a y − a y b x ) k = ( a y b z − a z b y ) i + ( a z b x − a x b z ) j + ( a x a y − a y b x ) k 则\ A \times B=\begin{vmatrix} i & j & k \\ a_x & a_y & a_z\\ b_x & b_y & b_z \end{vmatrix}\\=(a_yb_z-a_zb_y)i-(a_xb_z-a_zb_x)j+(a_xa_y-a_yb_x)k\\=(a_yb_z-a_zb_y)i+(a_zb_x - a_xb_z)j+(a_xa_y-a_yb_x)k Then A ×B=iaxbxjaybykazbz=(aybzazby)i(axbzazbx)j+(axayaybx)k=(aybzazby)i+(azbxaxbz)j+(axayaybx)k

At this time i,j,k is the corresponding direction for
(aybz − azby , azbx − axbz , axay − aybx ) (a_yb_z-a_zb_y,a_zb_x - a_xb_z,a_xa_y-a_yb_x)(aybzazbyazbxaxbzaxayaybx)

所以有
∣ A × B ∣ = ( a y b z − a z b y ) 2 + ( a z b x − a x b z ) 2 + ( a x a y − a y b x ) 2 = ∣ A ∣ ⋅ ∣ B ∣   s i n θ \vert A \times B \vert = \sqrt{(a_yb_z-a_zb_y)^2 + (a_zb_x - a_xb_z)^2 + (a_xa_y-a_yb_x)^2} =\vert A \vert \cdot \vert B \vert \ sin \theta A×B=(aybzazby)2+(azbxaxbz)2+(axayaybx)2 =AB sinθ
Code:

    //叉积
    public static M_Vector3 Cross(M_Vector3 V3_A,M_Vector3 V3_B)
    {
    
    
        return new M_Vector3(
            V3_A.y * V3_B.z - V3_A.z * V3_B.y,
            V3_A.z * V3_B.x - V3_A.x * V3_B.z,
            V3_A.x * V3_B.y - V3_A.y * V3_B.x);
    }

verify

        M_Vector3 v1 = new M_Vector3(1, Mathf.Sqrt(3), 3);
        M_Vector3 v2 = new M_Vector3(Mathf.Sqrt(3), 1, 5);
        float angle = M_Vector3.Angle(v1, v2);
        Debug.Log(angle);
        M_Vector3 normalVec = M_Vector3.Cross(v1, v2);
        Debug.Log("左边:" + (normalVec.Magnitude));
        Debug.Log("右边:" + (v1.Magnitude * v2.Magnitude * Mathf.Sin(angle * 2 * Mathf.PI / 360)));

The meaning of cross product:
the direction is the normal vector direction of the plane composed of two vectors, and the size is the area of ​​the parallelogram composed of two vectors

Vector product properties of vectors:
∣ a × b ∣ is the area of ​​a parallelogram whose sides are a and b. a × a = 0 . a / / b (parallel) ⟺ a × b = 0 |a×b| is the area of ​​a parallelogram whose sides are a and b. \\ \ \\ a×a=0. \\ \ \\ a//b (parallel)\iff a×b=0 \\ \ \\a×b | is the area of ​​a parallelogram whose sides are a and b . a×a=0 a / / b ( parallel )a×b=0 
向量的向量积运算律:
a × b = − b × a   ( λ a ) × b = λ ( a × b ) = a × ( λ b )   a × ( b + c ) = a × b + a × c .   ( a + b ) × c = a × c + b × c . a \times b=-b \times a \\ \ \\ (λa) \times b=λ(a \times b)=a \times (λb) \\ \ \\ a \times (b+c)=a\times b+a \times c. \\ \ \\ (a+b)×c=a×c+b×c. a×b=b×a (λa)×b=λ ( a×b)=a×(λb) a×(b+c)=a×b+a×c. (a+b)×c=a×c+b×c .
The above two distributive laws are called left distributive law and right distributive law respectively. In the calculation, it should be noted that the order of the vectors on both sides of the "×" sign cannot be exchanged.
Note:Vectors don't have division, "vector AB / vector CD" is meaningless.

4.6 Definition of three-vector mixed product
:
Given three vectors a, b, c in a given space, the vector product a×b of vector a, b, and the vector c are used for quantitative product (a×b)·c, the resulting number is called three vectors The mixed product of a, b, c is recorded as (a, b, c) or (abc), that is, (abc)=(a,b,c)=(a×b)·c

The mixed product has the following properties:
1. The absolute value of the mixed product of three non-coplanar quantities a, b, c is equal to the volume V of a parallelepiped with a, b, c as edges, and when a, b, c form a right-handed system, the mixed product is a positive number; when When a, b, and c form a left-handed system, the mixed product is a negative number, that is, (abc)=εV (when a, b, and c form a right-handed system, ε=1; when a, b, and c form a left-handed system, ε=-1 )
2. Inference of the above properties: the necessary and sufficient condition for the three vectors a, b, c to be coplanar is (abc)=0
. (abc)=(bca)=(cab)=-(bac)=-(cba)=-(acb)

4.7 Definition of double vector product
:
for three vectors a, b, c in a given space, if the vector product a×b of two of the vectors a and b is made first, and then the vector product of the obtained vector and the third vector is made, then finally The result is still a vector, called the double vector product of the given three vectors, denoted as: (a×b)×c.

Properties:
(a×b)×c=(a·c)·b-(b·c)·a a
×(b×c)=-(b×c)×a=(a·c)·b- (a b) c

Relational expression
Given four vectors a, b, c, and d in the space, the following relationship is satisfied between these four vectors:
( a × b ) ⋅ ( c × d ) = ( a ⋅ c ) ( b ⋅ d ) − ( a ⋅ d ) ( b ⋅ c ) (a \times b) \cdot (c \times d) = (a \cdot c)(b \cdot d)-(a \cdot d)(b \cdot c )(a×b)(c×d)=(ac)(bd)(ad)(bc)

5. Related definitions of vectors

5.1 Directed line segment
If the end point A of the line segment AB is specified as the starting point and the end point B is the end point, then the line segment has the direction and length from the starting point A to the end point B. A line segment that has a direction and a length is called a directed line segment.

    //有向线段从B指向A
    public static M_Vector2 DirectedLineSegment(M_Vector2 m_Vector2_A,M_Vector2 m_Vector2_B)
    {
    
    
        return m_Vector2_B - m_Vector2_A;
    }

5.2 The modulus of a vector
The size of a vector, that is, the length of a vector.
l = a ∣ a ∣ = aa T al=\cfrac{a}{\lvert a\lvert }=\cfrac{a}{\sqrt{a^Ta} }l=aa=aT a a

	//模长
    public float Magnitude
    {
    
    
        get
        {
    
    
            return (float)Math.Sqrt(x * x + y * y);
        }

    }

5.3 Unit vector A
vector whose length is one unit (ie modulo 1) is called a unit vector.

    //单位向量
    public static M_Vector2 One
    {
    
    
        get
        {
    
    
            return new M_Vector2(1, 1);
        }
    }

A normalized vector can also be seen as a unit vector

/归一化
    public M_Vector2 normalized
    {
    
    
        get
        {
    
    
            return Normalize(this);
        }
    }

    public static M_Vector2 Normalize(M_Vector2 m_Vector2)
    {
    
    
        return m_Vector2 / m_Vector2.Magnitude;
    }

    public M_Vector2 Normalize()
    {
    
    
        return Normalize(this);
    }

5.4 Negative vector (opposite vector)
If vector AB and vector CD have the same modulus and opposite directions, then we call vector AB the negative vector of vector CD, also known as the opposite vector.

    //负向量
    public static M_Vector2 operator -(M_Vector2 m_Vector2)
    {
    
    
        return new M_Vector2(-m_Vector2.x,-m_Vector2.y);
    }
    public static M_Vector2 NegativeVector(M_Vector2 m_Vector2)
    {
    
    
        return -m_Vector2;
    }

5.5 Zero vector
A vector with a length of 0 is called a zero vector, denoted as 0. The start point and end point of the zero vector coincide, so the zero vector has no definite direction, or the direction of the zero vector is arbitrary.

    //零向量
    public static M_Vector2 Zero
    {
    
    
        get
        {
    
    
            return new M_Vector2(0, 0);
        }
    }

5.6 Equal vectors Vectors
with the same length and the same direction are called equal vectors. The vector a is equal to b, denoted as a=b.
Requirement: All zero vectors are equal

//判断两个向量是否相等
	public static bool operator == (M_Vector2 m_Vector2_A,M_Vector2 m_Vector2_B)
    {
    
    
        if (m_Vector2_A.x == m_Vector2_B.x && m_Vector2_A.y == m_Vector2_B.y)
        {
    
    
            return true;
        }
        else
        {
    
    
            return false;
        }
    }
	//判断两个向量是否不相等
	public static bool operator !=(M_Vector2 m_Vector2_A, M_Vector2 m_Vector2_B)
    {
    
    
        if(m_Vector2_A == m_Vector2_B)
        {
    
    
            return false;
        }
        else
        {
    
    
            return true;
        }
    }

5.7 Free vector
A vector whose starting point is not fixed, it can move in parallel arbitrarily, and the moved vector still represents the original vector.
In the sense of free vectors, equal vectors are all considered to be the same vector.

M_Vector2 a1 = new M_Vector2(1, 2);
M_Vector2 a2 = new M_Vector2(1, 2);
M_Vector2 a3 = new M_Vector2(3, 2);

5.8 Slip vector
A vector acting along a straight line is called a slip vector.

    /// <summary>
    /// 滑动向量
    /// </summary>
    /// <param name="m_Vector2">方向</param>
    /// <param name="distance">滑动距离</param>
    /// <returns></returns>
    public static M_Vector2 SlipVector(M_Vector2 m_Vector2,float distance)
    {
    
    
        return m_Vector2 * distance;
    }

5.8 Fixed vector
A vector acting on a point is called a fixed vector (also known as a glue vector).
Code Reference Directed Line Segment

5.9 Position vector
For any point P in the coordinate plane, we call the vector OP the position vector of point P, denoted as: vector P.
Code Reference Directed Line Segment

5.10 Parallel vectors (collinear vectors)
Non-zero vectors with the same or opposite directions are called parallel (or collinear) vectors. Vectors a and b are parallel (collinear), denoted as a//b.
The zero vector has length zero, is a vector whose starting point and ending point coincide, and whose direction is indeterminate.
Requirement: The zero vector is parallel to any vector. A set of vectors that are parallel to the same line are collinear vectors.
If a=(x,y), b=(m,n), then a//b→a×b=xn-ym=0

    //判断两个向量是否公线
    public static bool  IsParallelVector(M_Vector2 m_Vector2_A,M_Vector2 m_Vector2_B)
    {
    
    
        if(m_Vector2_A.x * m_Vector2_B.y - m_Vector2_A.y * m_Vector2_B.x == 0)
        {
    
    
            return true;
        }
        else
        {
    
    
            return false;
        }
    }

5.11 Direction vector
The vector a on the straight line l and the vector collinear with the vector a are called the direction vector on the straight line l.
Code Reference Collinear Vectors

5.12 Coplanar vector (3-dimensional space)
Three (or more than three) vectors parallel to the same plane are called coplanar vectors.
Vectors in space have and only have the following two positional relationships:
⑴ coplanar;
⑵ non-coplanar.
Note: Only three or more vectors can talk about coplanarity or non-coplanarity.

5.13 Normal vector (3-dimensional space)
straight line l⊥α, take the direction vector a of the straight line l, then the vector a is called the normal vector of the plane α.
Vector Product Operation of Reference Vectors

6. Vector Theorem

6.1 Collinear Theorem
If b ≠ 0, then the necessary and sufficient condition for a / / b is that there is a unique real number λ, so that a → = λ b → . If a = ( ax , ay ) and b = ( bx , by ) are set, then axby = bxay, which is the same as the parallel concept. 0 → parallel to any vector. If b≠0, the necessary and sufficient condition of a//b is that there is a unique real number λ, so that \\ \ \\ \overrightarrow{a} = \lambda\overrightarrow{b}. \\ \ \\ If a=(a_x,a_y), b=(b_x,b_y), then \\ \ \\ a_xb_y=b_xa_y, \\ \ \\ is the same as the parallel concept. \overrightarrow{0} is parallel to any vector.if b=0 , then the necessary and sufficient condition for a / / b is that there is a unique real number λ , so that a =lb  if a _=(ax,ay)b=(bx,by) , then there are axby=bxay Same concept as Parallel .0 parallel to any vector .

6.2 The necessary and sufficient condition of vertical theorem a ⊥ b is a ⋅ b = 0 , ie ( axbx + ayby ​​) = 0 .
The necessary and sufficient condition for a⊥b is a·b=0, that is, (a_xb_x+a_yb_y)=0.The necessary and sufficient condition for a b is a b=0 , that is ( axbx+ayby)=0

6.3 Decomposition theorem
Plane vector decomposition theorem:
If e 1 → , e 2 → are two non-parallel vectors in the same plane, then for any vector in this plane, there is and only a pair of real numbers λ 1 , λ 2 , Let a → = λ 1 e 1 → + λ 2 e 2 → , we call the non-parallel vector , the basis of all vectors in this plane. If \overrightarrow{e_1}, \overrightarrow{e_2} are two non-parallel vectors in the same plane, \\ \ \\ Then for any vector in this plane, there is and only a pair of real numbers \lambda_1,\lambda_2 , \\ \ \\ Make \overrightarrow{a} =\lambda_1 \overrightarrow{e_1} + \lambda_2 \overrightarrow{e_2}, \\ \ \\ We call the non-parallel vector , the basis of all vectors in this plane.ife1 e2 are two non- parallel vectors in the same plane , Then for any vector in this plane , there is one and only one pair of real numbers λ1,l2 makea =l1e1 +l2e2  We call the non- parallel vectors the basis of all vectors in this plane .

6.4 Definite score formula
P = [ xy ] P 1 = [ x 1 y 1 ] P 2 = [ x 2 y 2 ] ( P − P 1 ) = λ ( P 2 − P ) P = 1 1 + λ ( P 1 + λ P 2 ) = 1 1 + λ [ xx + λ x 2 y 1 + λ y 2 ] where λ ∈ R ∗ , λ is the ratio of point P to directed line segment P 1 P 2 → . P=\begin{bmatrix} x \\ y\\ \\end{bmatrix}\ \ P_1=\begin{bmatrix} x_1 \\ y_1\\ \end{bmatrix} P_2=\begin{bmatrix} x_2 \\ y_2\ \ \end{bmatrix} \\ \ \\ (P - P_1) = \lambda(P_2 - P) \\ \ \\ P = \cfrac{1}{1 + \lambda}(P_1 + \lambda P_2)= \cfrac{1}{1 + \lambda}\begin{bmatrix} x_x + \lambda x_2 \\ y_1 + \lambda y_2\\ \end{bmatrix} \\ \ \\ where \lambda\in R^*, \ lambda is the ratio of point P directed line segment \overrightarrow{P_1P_2}.P=[xy]  P1=[x1y1]P2=[x2y2] (PP1)=λ ( P2P) P=1+l1(P1+λP _2)=1+l1[xx+λx2y1+λy2] where λR,λ is a directed line segment at point PP1P2 ratio . _ _

6.5 Theorem of three collinear points
It is known that O is a point outside the straight line where AB lies, if OC → = λ OA → + μ OB → , and λ + μ = 1 , then A , B , C are collinear. It is known that O is a point outside the straight line where AB is located. If \overrightarrow{OC} = \lambda \overrightarrow{OA} + \mu \overrightarrow{OB}, and \lambda + \mu = 1, then three points A, B, and C collinear.It is known that O is a point outside the straight line where A and B lie , ifOC =lOA +mOB ,and λ+m=1 , then the three points A , B and C are collinear .

6.6 The judgment formula of center of gravity
is in △ ABC, if GA → + GB → + GC → = 0 → , then G is the center of gravity of △ ABC is in \triangle ABC, if \overrightarrow{GA} + \overrightarrow{GB} + \overrightarrow {GC} = \overrightarrow{0}, then G is the center of gravity of \triangle ABCIn A B C , _likeGA +GB +GC =0 ,Then G is the center of gravity of A B C

6.7 Judgment formula of orthocenter
In △ ABC, if HA → ⋅ HB → = HB → ⋅ HC → = HC → ⋅ HA → , then H is the orthocenter of △ ABC. In \triangle ABC, if \overrightarrow{HA}\cdot \overrightarrow{HB} = \overrightarrow{HB} \cdot \overrightarrow{HC} = \overrightarrow{HC} \cdot \overrightarrow{HA}, then H is\ Orthocenter of triangle ABC.In A B C , if _HA HB =HB HC =HC HA , then H is the orthocenter of A B C.

6.8 The inner judgment formula
is in △ ABC, if a IA → + b IB → + c IC → = 0 → , and PI = a PA → + b PB → + c PC → a + b + c , then H is △ ABC heart. In \triangle ABC, if a\overrightarrow{IA} + b\overrightarrow{IB} +c\overrightarrow{IC} = \overrightarrow{0} , and PI = \cfrac{a\overrightarrow{PA} + b\overrightarrow {PB} +c\overrightarrow{PC}}{a+b+c}, then H is the heart of \triangle ABC.In A B C , if a _IA +bIB +cIC =0 ,and P I=a+b+caPA +bPB +cPC , then H is the interior of A B C.

6.9 Judgment formula of circumcenter
In △ ABC, if ∣ OA → ∣ = ∣ OB → ∣ = ∣ OC → ∣ , then O is the circumcenter of △ ABC. Now O satisfies ( OA → + OB → ) ⋅ AB → = ( ​​OB → + OC → ) ⋅ BC → = ( ​​OC → + OA → ) ⋅ CA → = 0 → . In \triangle ABC, if \lvert \overrightarrow{OA}\lvert = \lvert \overrightarrow{OB}\lvert =\lvert \overrightarrow{OC}\lvert , then O is the circumcenter of \triangle ABC. \\ \ \\ Now O satisfies (\overrightarrow{OA}+\overrightarrow{OB})\cdot \overrightarrow{AB} = (\overrightarrow{OB}+\overrightarrow{OC})\cdot \overrightarrow{BC} = (\overrightarrow{OC}+\overrightarrow{OA})\cdot \overrightarrow{CA} = \overrightarrow{0}.In A B C , _If OA =OB =OC ,Then O is the circumcenter of A B C. At this time O satisfies (OA +OB )AB =(OB +OC )BC =(OC +OA )CA =0 .
6.9 Vector midline formula
If P is the midpoint of line segment AB and O is a point in the plane, then OP → = 1 2 ( OA → + OB → ). If P is the midpoint of the line segment AB, and O is a point in the plane, then \overrightarrow{OP}=\cfrac{1}{2}(\overrightarrow{OA}+\overrightarrow{OB}).If P is the midpoint of the line segment A B , and O is a point in the plane , thenOP =21(OA +OB )

Guess you like

Origin blog.csdn.net/weixin_45724919/article/details/125149825