setEuler method Null safety
Set quaternion with rotation of yaw
, pitch
and roll
.
Implementation
void setEuler(double yaw, double pitch, double roll) {
final halfYaw = yaw * 0.5;
final halfPitch = pitch * 0.5;
final halfRoll = roll * 0.5;
final cosYaw = math.cos(halfYaw);
final sinYaw = math.sin(halfYaw);
final cosPitch = math.cos(halfPitch);
final sinPitch = math.sin(halfPitch);
final cosRoll = math.cos(halfRoll);
final sinRoll = math.sin(halfRoll);
_qStorage[0] = cosRoll * sinPitch * cosYaw + sinRoll * cosPitch * sinYaw;
_qStorage[1] = cosRoll * cosPitch * sinYaw - sinRoll * sinPitch * cosYaw;
_qStorage[2] = sinRoll * cosPitch * cosYaw - cosRoll * sinPitch * sinYaw;
_qStorage[3] = cosRoll * cosPitch * cosYaw + sinRoll * sinPitch * sinYaw;
}