normalize method
V2
normalize()
Returns a normalized (unit-length) copy of this vector.
Returns the zero vector if length is 0.
Implementation
V2 normalize() {
double length = this.length;
if (length > 0) {
double ilength = 1.0/length;
return _v2(x*ilength, y*ilength);
}
return _v2Zero;
}