Introduction to Graphics Math

Normalization

A: ()
B:

A vector is normalized when its length is 1. It is also referred to as a unit vector. Any vector with a length greater than zero can be normalized. A vector can be normalized by dividing each component by its magnitude. In this case B is a normalized version of A. In mathematics, a normalized vector is often represented with a hat symbol (^) over the variable. \[\textbf{B}=\hat{\textbf{A}}=\frac{\textbf{A}}{\|\textbf{A}\|}\] \[=\frac{(1.0,1.0)}{1.414}\] \[=\left(\frac{1.0}{1.414},\frac{1.0}{1.414}\right)\] \[=\underline{\underline{(0.707,0.707)}}\]

Things to try:

  • Drag A to (0,0). Notice how B is undefined. Zero vectors can't be normalized because dividing by zero is undefined. Implementations of normalize will sometimes just return (0,0) in that case, but don't assume so! Always be aware if a vector you want to normalize could be a zero vector.
  • Drag A so its length is greater than 1. Notice how B is shortened to 1.
  • Drag A so its length is less than 1. Notice how B is lengthened to 1.