Math‎ > ‎


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(x2+y2+z2).
  • A unit vector is a vector that has the magnitude of 1. To normalize a vector, divide the vector by its magnitude. vnorm = 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·b = a1b1, ... , anbn.
  • 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°)
Projection one vector onto another
    • Given two vectors v and n, we can separate v into two values, v|| and vt. They are parallel and perpendicular to n so that vv|| + vt 
    • 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 = [aybz-azby , azbx - axbz , axby - aybx]