Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-----------------------------------------------------------------------
- void quaternion::toMatrix(mat3 &mat) const
- {
- float x2 = x + x;
- float y2 = y + y;
- float z2 = z + z;
- float wx = x2 * w;
- float wy = y2 * w;
- float wz = z2 * w;
- float xx = x2 * x;
- float xy = y2 * x;
- float xz = z2 * x;
- float yy = y2 * y;
- float yz = z2 * y;
- float zz = z2 * z;
- mat[0] = 1.0f - (yy + zz); mat[1] = xy - wz; mat[2] = xz + wy;
- mat[3] = xy + wz; mat[4] = 1.0f - (xx + zz); mat[5] = yz - wx;
- mat[6] = xz - wy; mat[7] = yz + wx; mat[8] = 1.0f - (xx + yy);
- }
Advertisement
Add Comment
Please, Sign In to add comment