eulerYXZInto function
eulerYXZ written into out, which it returns: the product of the three
axis rotations worked out by hand, so posing a part every step allocates
nothing.
Implementation
Quaternion eulerYXZInto(Quaternion out, double x, double y, double z) {
final sx = math.sin(x * 0.5), cx = math.cos(x * 0.5);
final sy = math.sin(y * 0.5), cy = math.cos(y * 0.5);
final sz = math.sin(z * 0.5), cz = math.cos(z * 0.5);
// qy * qx, then that times qz.
final ax = cy * sx, ay = sy * cx, az = -sy * sx, aw = cy * cx;
return out..setValues(ax * cz + ay * sz, ay * cz - ax * sz, aw * sz + az * cz, aw * cz - az * sz);
}