Created
November 17, 2011 00:32
-
-
Save sansumbrella/1372000 to your computer and use it in GitHub Desktop.
Find the gaussian value of a position
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
// loc = distance from center of distribution | |
float gaussian( float loc, float variance ) | |
{ | |
variance *= variance; | |
float a = loc * loc / ( 2.0 * variance ); | |
float b = exp( -a ); | |
float c = sqrt( PI * 2.0 * variance ); | |
return b / c; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment