MCPcopy Create free account
hub / github.com/LingDong-/fishdraw / pattern_dot

Function pattern_dot

fishdraw.js:1045–1067  ·  view source on GitHub ↗
(scale=1)

Source from the content-addressed store, hash-verified

1043}
1044
1045function pattern_dot(scale=1){
1046 let samples = [];
1047 poissondisk(500,300,20*scale,samples);
1048 let rs = [];
1049 for (let i = 0; i < samples.length; i++){
1050 rs.push((rand()*5+10)*scale)
1051 }
1052 return function(x,y){
1053 for (let i = 0; i < samples.length; i++){
1054 let r = rs[i];
1055 if (dist(x,y,...samples[i])<r){
1056
1057 let [x0,y0] = samples[i];
1058 let dx = x - x0;
1059 let dy = y - y0;
1060 if (gauss2d(dx/r*2,dy/r*2)*noise(x,y,999) > 0.2){
1061 return true;
1062 }
1063 }
1064 }
1065 return false;
1066 }
1067}
1068
1069
1070

Callers 1

fishFunction · 0.85

Calls 5

poissondiskFunction · 0.85
randFunction · 0.85
distFunction · 0.85
gauss2dFunction · 0.85
noiseFunction · 0.85

Tested by

no test coverage detected