integrate method
Rotate an absolute orientation quaternion given an angular velocity and a time step.
Implementation
Quaternion integrate(Vec3 angularVelocity,double dt,Vec3 angularFactor, [Quaternion? target]){
target ??= Quaternion();
final ax = angularVelocity.x * angularFactor.x,
ay = angularVelocity.y * angularFactor.y,
az = angularVelocity.z * angularFactor.z,
bx = x,
by = y,
bz = z,
bw = w;
final halfDt = dt * 0.5;
target.x += halfDt * (ax * bw + ay * bz - az * by);
target.y += halfDt * (ay * bw + az * bx - ax * bz);
target.z += halfDt * (az * bw + ax * by - ay * bx);
target.w += halfDt * (-ax * bx - ay * by - az * bz);
return target;
}