normalize method

void normalize()

Implementation

void normalize() {
  final mag = magnitude;
  if (mag != 0) {
    x /= mag;
    y /= mag;
  }
}