Code: Select all
length = sqrt(x*x + y*y);
x /= length;
y /= length;
(I'm not using the C sqrt() function BTW, but somebody else's fast square root function, so it isn't quite as bad as it could be)

Code: Select all
length = sqrt(x*x + y*y);
x /= length;
y /= length;

Exactly - as long as I keep the ratio between the X and Y components of my vector, is that usually enough?_case wrote: i take it your not just after another fast square root function/sqrt table etc. ? but rather someway of bypassing sqrt altogeather to get normalization of your vectors?
Ah - then is the sqrt() used mainly to prevent overflow during matrix operations? Thanks, i'll give that a shot - even if it turns out that I really do need a fully normalised vector, hopefully that will be enough for me to do a surface test and only sqrt() the normals I really need - i'm still learning, but things are beginning to click into place.Riff wrote: In many cases, full blown normalization is not necessary and all you really need to do is multiply the transformed normal vector by a scale factor.
