// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Remove near-duplicate route points // Not compiled or tested in-world // Setup: Use a spare owned prim. Set POINTS and nonnegative MIN_DISTANCE. Owner touch prints sample coordinates. // Stop / restore: Remove/disable. Nothing is rezzed or moved. // Notes: The final endpoint is always retained, which may leave a short final segment. This does not preserve sharp corners like a full simplifier. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Planning only. list POINTS=[<0.0,0.0,0.0>,<0.02,0.0,0.0>,<1.0,0.0,0.0>,<1.01,0.0,0.0>,<2.0,1.0,0.0>]; float MIN_DISTANCE=0.1; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; integer n=llGetListLength(POINTS); if(n==0||MIN_DISTANCE<0.0) { llOwnerSay("Need points and nonnegative threshold."); return; } list kept=[llList2Vector(POINTS,0)]; vector last=llList2Vector(POINTS,0); integer i; for(i=1;i=MIN_DISTANCE||i==n-1) { kept+=[p]; last=p; } } llOwnerSay("Kept="+(string)llGetListLength(kept)+": "+llDumpList2String(kept," | ")); } }