normalize method

Vector4D normalize()

Implementation

Vector4D normalize() {
  double length = this.length;
  if (length == 0.0) length = 1.0;
  final ilength = 1.0/length;
  return .vec4(
    x*ilength,
    y*ilength,
    z*ilength,
    w*ilength,
  );
}