1. Vector - Basics (2D)

All notation is in 2D but it applies in 3D too

Points

Notation

R2= xy plane
R3= xyz plane

Let P = (x1,y1), Q = (x2,y2),

Mid point

MPQ=P+Q2=(x1+x22,y1+y22)

Distance

d(P,Q)=(x2x1)2+(y2y1)2

Vectors

PQ=QP=OQOP

Let u=[u1u2], v=[v1v2]

Length

a=a12+a22

Dot product (Info)

ab=a1b1+a2b2

If dot product > 0, angle between a and b is < 90
If dot product = 0, angle between a and b is = 90
If dot product < 0, angle between a and b is > 90
Why? Because of the cos1

Angle between 2 vectors

θ=cos1(abab)

Special cases

Dot product result Angle
-1 180
0 90
1 0
^ ONLY WORKS FOR UNIT VECTORS ^

For dot product 1 and -1 NEED to be unit vectors. For dot product 0, it doesn't matter

Checking if vectors are parallel/perpendicular

For parallel

u=cv
u must be a scalar of v

If u and v are unit vectors, can use Dot product, Special cases

For perpendicular

uv=0
See Dot product, Special cases

Making a normal vector

In 2 steps:

  1. Swap x and y
  2. Negate either the x or y
    • Negate x to rotate 90 anti-clockwise
    • Negate y to rotate 90 clockwise
Example

d=[23]

n=[32]

Vector Projection (Info)

Project b onto a,

General:

projab=baa2a

If a is a unit vector:

projab=(ba^)a^

Checking if moving towards a point

Only 1 point moving

Get a vector QP,
Find QPv
At Q , Result < 0, angle is < 90 so moving towards
At Q1, Result = 0, angle is = 90. Neither moving towards/away. This is will only happen for a split second
At Q2, Result > 0, angle is > 90 so moving away

2 points moving

Assume P is stationary **relative** to Q #todo-low

Checking if a moving point will hit line

Hit Miss
Hit if the signs of these 2 are different
QPn<0    !=    vn<0

Excalidraw - Full table