normalize method

Quaternion normalize()

Implementation

Quaternion normalize() {
  var l = length();

  if (l == 0) {
    _x = 0;
    _y = 0;
    _z = 0;
    _w = 1;
  } else {
    l = 1 / l;

    _x = _x * l;
    _y = _y * l;
    _z = _z * l;
    _w = _w * l;
  }

  onChangeCallback();

  return this;
}