gaGaussianFn(float,float,float,float)

Syntax

gaGaussianFn(float,float,float,float)

Example

noiseTimeA = ofRandom(0,10000)
noiseTimeC = ofRandom(7000,17000)
stepA = ofRandom(0.001,0.003)
stepC = ofRandom(0.001,0.003)
amplitude = 0
width = 0

function update()
    amplitude = ofMap(ofNoise(noiseTimeA),0.15,0.85,0,OUTPUT_H/2)
    width = ofMap(ofNoise(noiseTimeC),0.15,0.85,0,OUTPUT_W/3)
 
    noiseTimeA += stepA
    noiseTimeC += stepC
end

function draw()
    gaBackground(0.0,0.01)
 
    ofSetColor(255,10)
 
    for i=0,OUTPUT_W-1 do
        ofCircle(i,(OUTPUT_H/2)-gaGaussianFn(i,amplitude,OUTPUT_W/2,width),1)
    end
end

Description

The graph of a Gaussian is a characteristic symmetric "bell curve" shape that quickly falls off towards plus/minus infinity.

We use this function like this: y = gaGaussianFn(x,a,b,c) The parameter a (amplitude) is the height of the curve's peak, b (center) is the position of the centre of the peak, and c (width) controls the width of the "bell". More info http://en.wikipedia.org/wiki/Gaussian_function

Parameters

float,float,float,float

Returns

«Float, The Y of the gaussian distribution