• 10
• 9
• 12
• 14
• 15

# what is it to "normalise " a vector?

This topic is 4860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

ive seen it mentioned a few times, and i think it might be useful to my application , but i am unsure of its full meaning, and how to implement it . any suggestions/explinations?

##### Share on other sites
A normalized vector is just a vector with a magnitude of one. To normalize a vector, just divide all its components by its magnitude.

##### Share on other sites
When you normalize a vector you make the length of it equal to 1. To normalize you just devide the x, y, z coords by the length of the vector. This then gives you the Unit Vector.

##### Share on other sites
It takes the vector and makes its length/magnitude to be 1.

Normalization: [ai]=[ai/|a|] (i=1,n)

##### Share on other sites
So why would you want to do that? [help]

##### Share on other sites
To normalize a vector, you make its magnitude equal to 1.0. That is to say, a vector that is [0 10 0] would normalize to [0 1 0]. Here is the math:

float dist = sqrt( (x * x)+(y * y)+(z * z) );x = x * ( 1.0 / dist );y = y * ( 1.0 / dist );z = z * ( 1.0 / dist );

basicly, it scales every element in the vector up or down to produce a magnitude of 1.0. Hope this helps.

##### Share on other sites
Quote:
 Original post by Anonymous PosterSo why would you want to do that? [help]

One example is an application of the dot product of two vectors:

X . Y == |X| * |Y| * cos(theta)

|X| and |Y| are the magnitudes of the vectors X and Y, respectively. If X and Y are normalised, then |X| * |Y| == 1, so by computing the dot product you simply have cos(theta), where theta is the angle between X and Y.

##### Share on other sites
Quote:
 Original post by Anonymous PosterSo why would you want to do that? [help]

It seems most usefull for measuring angles with the vectors. If the vectors magnitude is greater, the results will not be within the acceptable range.

Also, if you don't know how far you want your vector to be. Then it is probabaly a direction. Which makes it being normalized much easier to apply a variable scalar to get the correct results.

I can't think of an example off-hand, but try doing some cross product, and dot product operations on non-normalized vectors and examine the results. And I mean, do them by hand on paper. This will give you the best grasp on the situation.