normalize method

Vector2D normalize()

Implementation

Vector2D normalize()
{
  double length = this.length;
  if (length > 0) {
    double ilength = 1.0/length;
    return .vec2(x*ilength, y*ilength);
  }
  return .zero();
}