Help those suffering in the Horn of Africa

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
 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

88,061 Spam Comments Blocked so far by Spam Free Wordpress

HTML tags are not allowed.

© 2013 Lighthouse3d.com Suffusion theme by Sayontan Sinha