tags:

views:

48

answers:

2

After reading google, I still don't quite understand what this does/means? Could someone explain this? Possibly a simple example? Thank you very much.

A: 

Normalizing a vector scales it to length 1.0, without changing its direction.

Edit: This works by finding the length of the vector and then dividing each of the co-ordinates by the length:

length = sqrt(x*x + y*y + z*z);

norm = [ x / length, y / length, z / length];

Clearly you cannot normalize a zero-length vector.

Jackson Pope
Making it a 'unit vector', good for all kinds of interesting calculations.
Emiel
What is this unit vector? what makes it different compared to a normal vector?
RoR
A unit vector is any vector of length 1.
Jackson Pope
+4  A: 

Normalizing a vector means changing its components so its total length is equal to 1.

In pseudo-code:

length = sqrt((vec.x * vec.x) + (vec.y * vec.y) + (vec.y * vec.y))
vec.x /= length
vec.y /= length
vec.z /= length

This has many uses in real-time 3D, as normed vectors have interesting properties.

jv42