Created
January 26, 2013 00:14
-
-
Save Hoikas/4639076 to your computer and use it in GitHub Desktop.
Compressed Quats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // To store a quat in 64 bits, we find which element is the largest and use 2 bits to | |
| // store which one it is. We now know the other 3 elements fall in the range | |
| // of [-kOneOverRootTwo, kOneOverRootTwo]. We scale that range across 20/21/21 bits | |
| // and store each. When extracting, we use the fact that the quat was normalized | |
| // to compute the 4th element. | |
| ... | |
| // To store a quat in 32 bits, we find which element is the largest and use 2 bits to | |
| // store which one it is. We now know the other 3 elements fall in the range | |
| // of [-kOneOverRootTwo, kOneOverRootTwo]. We scale that range across 10 bits | |
| // and store each. When extracting, we use the fact that the quat was normalized | |
| // to compute the 4th element. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment