Magnitude
From Tech Artists Wiki
Magnitude, in computer graphics, generally refers to the length of a vector. The length of vector a is denoted in mathematical terms as ||a||. Most languages have built-in functions to find the length of a vector, and these should be used whenever possible.
If we think of a 2D vector, the X and Y components of the vector corresponding to the orthogonal sides of a righ triangle, the length of a vector is the length of the hypotenuse of a triangle.
length = sqrt(vector.x + vector.y)
Thus the formula to determine the length of a 3D vector is:
length = sqrt(vector.x^2 + vector.y^2 + vector.z^2)
or more simply, the square root of the dot product of the vector with itself:
length = sqrt(dot(vector, vector))
- See also: Unit Vector, a vector with a length of 1
Categories: Math | Code
