Created
October 20, 2012 04:17
-
-
Save aaronsnoswell/3921992 to your computer and use it in GitHub Desktop.
Fast Unit Vector Normalisation for Discrete Spaces
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
// Really (really) fast unit vector normalisation | |
var c = 0.7071067812; | |
if(v[X] != 0 && v[Y] != 0) { | |
v[X] *= c, v[Y] *= c; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment