MCPcopy Create free account
hub / github.com/carbonengine/trinity / gaussian

Function gaussian

trinity/Tr2SSSSS.cpp:21–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19namespace
20{
21Vector3 gaussian( float variance, float r )
22{
23 /**
24 * We use a falloff to modulate the shape of the profile. Big falloffs
25 * spreads the shape making it wider, while small falloffs make it
26 * narrower.
27 */
28 Vector3 falloff = Vector3( 1.0f, 0.37f, 0.3f );
29
30 Vector3 g;
31 for( int i = 0; i < 3; i++ )
32 {
33 float rr = r / ( 0.001f + falloff[i] );
34 g[i] = exp( ( -( rr * rr ) ) / ( 2.0f * variance ) ) / ( 2.0f * 3.14f * variance );
35 }
36 return g;
37}
38
39Vector3 profile( float r )
40{

Callers 1

profileFunction · 0.85

Calls 1

Vector3Class · 0.70

Tested by

no test coverage detected