// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Fit fence pickets between posts // Not compiled or tested in-world // Setup: Put in a spare owned prim. Set clear span, picket width and minimum gap. Touch to print the plan privately. // Stop / restore: Remove/disable; calculations do not alter objects. // Notes: Includes gaps adjacent to both end posts. If none fit, it reports that instead of returning negative dimensions. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Calculation only. float SPAN=5.0; float WIDTH=0.12; float MIN_GAP=0.08; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(SPAN<=0.0||WIDTH<=0.0||MIN_GAP<0.0) { llOwnerSay("Invalid dimensions."); return; } integer count=llFloor((SPAN-MIN_GAP)/(WIDTH+MIN_GAP)); if(count<1) { llOwnerSay("No picket fits."); return; } float gap=(SPAN-count*WIDTH)/(count+1); llOwnerSay("Pickets="+(string)count+" clear gaps="+(string)gap+" first centre="+(string)(gap+WIDTH*0.5)); } }