// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Touch-sampled soft union of two circles // Not compiled or tested in-world // Setup: Put in a spare ordinary cube you own. Touch different places on one face to sample the procedural pattern at live surface coordinates. Edit the constants to design a pattern. // Stop / restore: Disable/remove. Only private owner messages are produced; no texture or tint is applied. // Notes: The polynomial smooth minimum rounds the join and slightly expands the combined silhouette. Surface coordinates depend on the viewer and mesh; ordinary prim faces are the clearest test surface. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Live surface-coordinate sampler. float RADIUS=0.4; float SMOOTH_RADIUS=0.2; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; vector uv=llDetectedTouchST(0); if(llDetectedTouchFace(0)<0||uv==TOUCH_INVALID_TEXCOORD) { llOwnerSay("Surface coordinates unavailable."); return; } vector p=2.0*uv-<1.0,1.0,0.0>; if(RADIUS<=0.0||SMOOTH_RADIUS<=0.0) { llOwnerSay("Positive radius/smoothing required."); return; } float a=llVecDist(p,<-0.3,0.0,0.0>)-RADIUS; float b=llVecDist(p,<0.3,0.0,0.0>)-RADIUS; float h=0.5+0.5*(b-a)/SMOOTH_RADIUS; if(h<0.0)h=0.0; if(h>1.0)h=1.0; float d=b+(a-b)*h-SMOOTH_RADIUS*h*(1.0-h); llOwnerSay("Smooth union distance="+(string)d+" inside="+(string)(d<=0.0)); } }