qInvert method

QuaternionD qInvert()

Implementation

QuaternionD qInvert() {
  final lengthSq = x*x + y*y + z*z + w*w;

  if (lengthSq != 0.0) {
    final invLength = 1.0/lengthSq;

    return .vec4(
      x * -invLength,
      y * -invLength,
      z * -invLength,
      w * invLength,
    );
  }

  return this;
}