What is normalize () for?

BufferAttribute has a normalize() function

I don’t understand how it works - normalize (); What is it for? I read Unit vector - Wikipedia but didn’t understand everything :dizzy_face:

Can you please show in the code where this method is defined?

Some vectors require unit length. Normalization is the mathematical process that ensures this property.

2 Likes

(In super simple way - it just makes vector.length() equal to 1 by scaling x/y/z equally. “Unit vector” = “vector of length 1”.)

1 Like

That’s what happens internally: three.js/Vector3.js at cf04fca253477f40e04488229cfcaf0f280e448b · mrdoob/three.js · GitHub

1 Like