• Advertisement
Sign in to follow this  

what is it to "normalise " a vector?

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


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

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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
So why would you want to do that? [help]

Share this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
So 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 this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
So 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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement