Vector3 AtoB = B - A- Vectors will be written inside []. Ex [4,7,9].
- The zero vector of any dimension will use a boldface zero as variable.
**0**= [0,0,..,0]. - To negate a vector we negate each component of the vector. [1,2,3] => [-1,-2,-3].
- The length of a vector
**v**is written as ||**v**||. The length is the square root of the sum of the squares of the components of the vector. Ex v = [*x*,*y*,*z*]. ||v|| = sqrt(*x*^{2}+*y*^{2}+*z*^{2}). - A unit vector is a vector that has the magnitude of 1. To normalize a vector, divide the vector by its magnitude.
**v**_{norm}=**v**/ ||**v**||.
Vector Dot Product- The dot product of two vectors is the sum of the products respective components, this results in a scalar.
**a**= a**·**b_{1}b_{1}, ... , a_{n}b_{n.} - The dot product is equal to the product of the magnitude of the vectors and the cosine of the angle between the vectors.
**a**= ||**·**b**a**|| ||**b**|| cos θ. - The angle between two vectors is. θ = acos(
**a**/ ||**·**b**a**|| ||**b**|| ) - If both vectors is unit vectors the divide is not needed so it's θ = acos(
**a**)**·**b - If we only care about the relative orientation about the vectors the acos can be skipped and only look at the sign of the dot product.
- + : The vectors are in the same direction ( θ < 90
**°**). - 0 : The vectors are perpendicular.
- - : In opposite directions ( 90
**°**< θ < 180**°**)
- Given two vectors
**v**and**n**, we can separate**v**into two values,**v**_{||}and**v**_{t}. They are parallel and perpendicular to**n**so that**v**=**v**_{||}+**v**_{t} **v**_{||}is the result of projecting**v**onto**n**.**v**_{||}=**n**(**v**/ ||**·**n**n**||^{2}).
Vector cross product- Only works on 3D vectors.
- It gives a vector that is perpendicular to the two original vectors.
- The length of the vector is equal to the product of the magnitudes of a and b and the sine of the angle
- Cross product use × as symbol.
**a**×**b**= -(**b**×**a**)**a**×**b**= [a_{y}b_{z}-a_{z}b_{y}, a_{z}b_{x}- a_{x}b_{z}, a_{x}b_{y}- a_{y}b_{x}]
Reference |

Math >