setDQ method

void setDQ(
  1. Quaternion q,
  2. Vector3 omega
)

Set the quaternion to the time derivative of q with angular velocity omega.

Implementation

void setDQ(Quaternion q, Vector3 omega) {
  final qStorage = q._qStorage;
  final omegaStorage = omega.storage;
  final qx = qStorage[0];
  final qy = qStorage[1];
  final qz = qStorage[2];
  final qw = qStorage[3];
  final ox = omegaStorage[0];
  final oy = omegaStorage[1];
  final oz = omegaStorage[2];
  final _x = ox * qw + oy * qz - oz * qy;
  final _y = oy * qw + oz * qx - ox * qz;
  final _z = oz * qw + ox * qy - oy * qx;
  final _w = -ox * qx - oy * qy - oz * qz;
  _qStorage[0] = _x * 0.5;
  _qStorage[1] = _y * 0.5;
  _qStorage[2] = _z * 0.5;
  _qStorage[3] = _w * 0.5;
}