normalizeFast method

Quaternion normalizeFast()

Approximation of quaternion normalization. Works best when quat is already almost-normalized. @author unphased, https://github.com/unphased

Implementation

Quaternion normalizeFast(){
  final f = (3.0 - (x * x + y * y + z * z + w * w)) / 2.0;
  if (f == 0) {
    x = 0;
    y = 0;
    z = 0;
    w = 0;
  } else {
    x *= f;
    y *= f;
    z *= f;
    w *= f;
  }
  return this;
}