axis property Null safety

Vector3 axis

axis of rotation.

Implementation

Vector3 get axis {
  final den = 1.0 - (_qStorage[3] * _qStorage[3]);
  if (den < 0.0005) {
    // 0-angle rotation, so axis does not matter
    return Vector3.zero();
  }

  final scale = 1.0 / math.sqrt(den);
  return Vector3(
      _qStorage[0] * scale, _qStorage[1] * scale, _qStorage[2] * scale);
}