copyRotationInto method
Set rotationMatrix to a rotation matrix containing the same rotation as
this.
Implementation
Matrix3 copyRotationInto(Matrix3 rotationMatrix) {
final double d = length2;
assert(d != 0.0);
final double s = 2.0 / d;
final double x = _qStorage[0];
final double y = _qStorage[1];
final double z = _qStorage[2];
final double w = _qStorage[3];
final double xs = x * s;
final double ys = y * s;
final double zs = z * s;
final double wx = w * xs;
final double wy = w * ys;
final double wz = w * zs;
final double xx = x * xs;
final double xy = x * ys;
final double xz = x * zs;
final double yy = y * ys;
final double yz = y * zs;
final double zz = z * zs;
final Float64List rotationMatrixStorage = rotationMatrix.storage;
rotationMatrixStorage[0] = 1.0 - (yy + zz); // column 0
rotationMatrixStorage[1] = xy + wz;
rotationMatrixStorage[2] = xz - wy;
rotationMatrixStorage[3] = xy - wz; // column 1
rotationMatrixStorage[4] = 1.0 - (xx + zz);
rotationMatrixStorage[5] = yz + wx;
rotationMatrixStorage[6] = xz + wy; // column 2
rotationMatrixStorage[7] = yz - wx;
rotationMatrixStorage[8] = 1.0 - (xx + yy);
return rotationMatrix;
}