Help end child hunger

Vector Length

Prev: Catmull-Rom Spline Next: Cross Product
 

The length of a vector v(x,y,z) can be computed as

mag = \sqrt[]{x^{2} + y^{2} + z^{2}}

In CG, we normally need a vector which is unit length, aka a normalized vector. To obtain a normalized vector just divide its components by the vector’s magnitude.

  \displaystyle n = \frac{v}{|v|}

i.e., the components of vector n will be:

\displaystyle n = (\frac{x}{mag}, \frac {y}{mag}, \frac{z}{mag})

 

Prev: Catmull-Rom Spline Next: Cross Product
 
© 2014 Lighthouse3d.com Suffusion theme by Sayontan Sinha