Skip to content

Instantly share code, notes, and snippets.

@Hoikas
Created January 26, 2013 00:14
Show Gist options
  • Select an option

  • Save Hoikas/4639076 to your computer and use it in GitHub Desktop.

Select an option

Save Hoikas/4639076 to your computer and use it in GitHub Desktop.
Compressed Quats
// 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