Last active
July 10, 2018 18:11
-
-
Save Pyromuffin/03da4469a607ea35fdf37a1a7af93bb3 to your computer and use it in GitHub Desktop.
This file contains 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
uint2 IntegerRotate(int2 right, int2 up, int2 offset, uint2 pos) | |
{ | |
static const int BIG_NUMBER_EXPONENT = 20; | |
uint2 rotatedPos; | |
rotatedPos.x = pos.x * right.x + pos.y * right.y; | |
rotatedPos.y = pos.x * up.x + pos.y * up.y; | |
rotatedPos += offset; | |
rotatedPos = rotatedPos >> BIG_NUMBER_EXPONENT; | |
return rotatedPos; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment