setDQ method

void setDQ (Quaternion q, Vector3 omega)

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

Implementation

void setDQ(Quaternion q, Vector3 omega) {
  final Float64List qStorage = q._qStorage;
  final Float64List omegaStorage = omega.storage;
  final double qx = qStorage[0];
  final double qy = qStorage[1];
  final double qz = qStorage[2];
  final double qw = qStorage[3];
  final double ox = omegaStorage[0];
  final double oy = omegaStorage[1];
  final double oz = omegaStorage[2];
  final double _x = ox * qw + oy * qz - oz * qy;
  final double _y = oy * qw + oz * qx - ox * qz;
  final double _z = oz * qw + ox * qy - oy * qx;
  final double _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;
}