This browser has no WebGPU, so the sketch cannot run here. The program is below, and it runs in a current Chrome, Edge or Safari.
Logical Ops
A collection of field based sampling and masking methods
////////////////////////////////////////////////////////////
// logical-ops
// A collection of field based sampling and masking methods.
////////////////////////////////////////////////////////////
&dim = (32,32,1);
&scl = (0.45);
&res = 8;
// 2D COORDINATE SPACE
#A{dim = &dim; set = C ;} // x coordinate
#B{dim = &dim; set = C.x ;} // y coordinate
#C{dim = &dim; set = C.y ;} // y coordinate
#D{dim = &dim; set = min(C.x, C.y) ;} // minimum
#E{dim = &dim; set = max(C.x, C.y) ;} // maximum
// BINARY / LOGIC
#F{dim = &dim; set = lrg(C.x, C.y) ;} // larger than
#G{dim = &dim; set = sml(C.x, C.y) ;} // smaller than
#H{dim = &dim; set = eql(C.x, C.y) ;} // equal to
#I{dim = &dim; set = abs(sub(lrg(C.x, 0), lrg(C.y, 0))) ;} // xor
#J{ dim = &dim; set = abs(sub(lrg(dom_phs(C.x, 0.5), 0.25), lrg(dom_phs(C.y, 0.5), 0.25)));} // checker / plaid
// TRIGONOMETRY
#K{dim = &dim; set = sin(mlt(C.x, &res)) ;} // sine
#L{dim = &dim; set = cos(mlt(C.y, &res)) ;} // cosine
#M{dim = &dim; set = cos(mlt(C.x, C.y, &res)) ;} // compound
#N{dim = &dim; set = asn(mlt(C.x, C.y, &res ));} // arc sine
#O{dim = &dim; set = mlt(sin(mlt(C.x, &res)), cos(mlt(C.y, &res) )) ;} // compound
// SPATIAL
#P{dim = &dim; set = len(C) ;} // radius
#Q{dim = &dim; set = abs(mod(C.x, C.y)) ;} // modulo
#R{dim = &dim; set = sin(mlt(len(C), &res)) ;} // radial rings
#S{dim = &dim; set = sin(mlt(atn(C.x, C.y), &res)) ;} // angular spokes
#T{dim = &dim; set = sin(mlt(add(len(C), atn(C.x, C.y) ), &res)) ;} // spiral
// COMPOSITION
#U{dim = &dim; set = sml(len(C), 0.5) ;} // circular mask
#V{dim = &dim; set = lrg(C.x, 0) ;} // half-plane mask
#W{dim = &dim; set = mlt(#U, #V) ;} // mask intersection
#X{dim = &dim; set = add( mlt(#R, #U), mlt(#S, sub(1, #U))) ;} // masked mix
#Y{dim = &dim; set = mlt(#U, avg(#T, #X)) ;} // masked mix
// FORMATIONS
~A{col = #A;scl = &scl; pos = (-2,2,0);}
~B{col = #B;scl = &scl; pos = (-1,2,0);}
~C{col = #C;scl = &scl; pos = (0,2,0);}
~D{col = #D;scl = &scl; pos = (1,2,0);}
~E{col = #E;scl = &scl; pos = (2,2,0);}
~F{col = #F;scl = &scl; pos = (-2,1,0);}
~G{col = #G;scl = &scl; pos = (-1,1,0);}
~H{col = #H;scl = &scl; pos = (0,1,0);}
~I{col = #I;scl = &scl; pos = (1,1,0);}
~J{col = #J;scl = &scl; pos = (2,1,0);}
~K{col = #K;scl = &scl; pos = (-2,0,0);}
~L{col = #L;scl = &scl; pos = (-1,0,0);}
~M{col = #M;scl = &scl; pos = (0,0,0);}
~N{col = #N;scl = &scl; pos = (1,0,0);}
~O{col = #O;scl = &scl; pos = (2,0,0);}
~P{col = #P;scl = &scl; pos = (-2,-1,0);}
~Q{col = #Q;scl = &scl; pos = (-1,-1,0);}
~R{col = #R;scl = &scl; pos = (0,-1,0);}
~S{col = #S;scl = &scl; pos = (1,-1,0);}
~T{col = #T;scl = &scl; pos = (2,-1,0);}
~U{col = #U;scl = &scl; pos = (-2,-2,0);}
~V{col = #V;scl = &scl; pos = (-1,-2,0);}
~W{col = #W;scl = &scl; pos = (0,-2,0);}
~X{col = #X;scl = &scl; pos = (1,-2,0);}
~Y{col = #Y;scl = &scl; pos = (2,-2,0);}
{ = (0,0,7);}