evaluate(s)
void
evaluatePixel()
{
// Crystallize, pseudo Voronoi-diagram using three nearby points,
// calculated from 'randomly' placed and rotated rectangular grids
// 1st grid and point
float div=size;
float2 newP= base1 + rot1r*div*( floor( rot1*(outCoord()-base1)/div ) +0.5);
// 2nd grid
div= 21.0/20.0*size; // factor 21, I picked some number that has no common denominators with the default size 20
float2 p= base2 + rot2r*div*( floor( rot2*(outCoord()-base2)/div ) +0.5);
// comparing distance to the 1st sample point
newP = length(p-outCoord()) < length(newP-outCoord()) ? p : newP;
// 3rd grid
div= 19.0/20.0*size;
p= div*( floor( outCoord()/div ) +0.5);
// comparing distance
newP = length(p-outCoord()) < length(newP-outCoord()) ? p : newP;
// the new color is picked from the nearist point
dst = sampleNearest(src,newP);
}
}