You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// gaussian where the curve is defined by a=1,b=0,c=0.3// to get a bell curve that is going from 1 to 0 in y, centered on 0 in x.// https://www.desmos.com/calculator/pbnihoalbr// sampled at 10 spots: 0 to 1 at 0.1 increments// Approximation (by hand):// (0,1), (.1,.95), (.2,.8), (.4,.4), (.5,.25),// (.6,.135), (.7,.06), (.8,.03), (.9,.01), (1,0)vargaussianStops=[0,gg(1),0.1,gg(.95),.2,gg(.8),.4,gg(.4),.5,gg(.25),.6,gg(.135),.7,gg(.06),.8,gg(.03),.9,gg(.01),1,gg(0)];// calculate it with a function instead!// basic gaussian curve: g = a exp(- (x-b)^2 / (2c^2))// https://en.wikipedia.org/wiki/Gaussian_function// make a function that calculates gradient stops// where r is the sampling rate (along the x-axis)// returns r+1 stops (because with count the 0,1 point)functiongaussianGradient(a,b,c,r=10,useAlpha=false){varstops=[];for(vari=0;i<=r;i++){constx=i/r;constg=a*Math.exp((-Math.pow(x-b,2))/(2*Math.pow(c,2)));stops.push(x,scaledIntensityRGBA(g,useAlpha));}returnstops;}// replace with a calculated/more accurate onegaussianStops=gaussianGradient(1,0,0.3,1000,1);
Demo/test using a Gaussian point spread function like beam:
https://codepen.io/joedf/pen/jOeyKZg?editors=0111
The text was updated successfully, but these errors were encountered: