setRotationFromQuaternion method
Set the matrix from a quaterion
Implementation
Mat3 setRotationFromQuaternion(Quaternion q){
final x = q.x;
final y = q.y;
final z = q.z;
final w = q.w;
final x2 = x + x;
final y2 = y + y;
final z2 = z + z;
final xx = x * x2;
final xy = x * y2;
final xz = x * z2;
final yy = y * y2;
final yz = y * z2;
final zz = z * z2;
final wx = w * x2;
final wy = w * y2;
final wz = w * z2;
List<double> e = elements;
e[3 * 0 + 0] = 1 - (yy + zz);
e[3 * 0 + 1] = xy - wz;
e[3 * 0 + 2] = xz + wy;
e[3 * 1 + 0] = xy + wz;
e[3 * 1 + 1] = 1 - (xx + zz);
e[3 * 1 + 2] = yz - wx;
e[3 * 2 + 0] = xz - wy;
e[3 * 2 + 1] = yz + wx;
e[3 * 2 + 2] = 1 - (xx + yy);
return this;
}