Normalizing zero vectors

If you invoke vmath.normalize(vector) on a zero vector the result is a vector where the coordinates are NaN. This is due to division by zero in the implemetion of normalize(). While it could be argued that the behavior is correct it would be much more convenient if the result was a zero vector. Currently this forces me to use if-checks occasionally to avoid my vectors becoming corrupt. The problem could easily be solved by a simple check to see if the lenght of the vector is zero before dividing.

I think the reasoning is this: Returning a zero vector would return a non unit length vector in the case where you pass a zero vector which doesn’t make sense (a zero length vector is not normalized and, as you say, cannot be normalized). That could introduce subtle bugs and it is better to deal with the error head on.