// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Locate a point by approximate curve distance // Not compiled or tested in-world // Setup: Use a spare owned prim. Set control points and FRACTION in zero through one. Touch for owner-only results. // Stop / restore: Disable/remove. No scene properties change. // Notes: Twenty segments approximate distance; interpolating between samples introduces error. Useful for even travel, not exact arc-length inversion. // License: see LICENSE in this distribution. // Original Incoprea. MIT. vector A=<0.0,0.0,0.0>; vector B=<1.0,8.0,0.0>; vector C=<3.0,-2.0,0.0>; vector D=<10.0,0.0,0.0>; float FRACTION=0.5; vector curve(float t) { float u=1.0-t; return u*u*u*A+3.0*u*u*t*B+3.0*u*t*t*C+t*t*t*D; } default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(FRACTION<0.0||FRACTION>1.0) { llOwnerSay("Fraction must be0..1."); return; } list points=[A]; list lengths=[0.0]; float total; vector last=A; integer i; for(i=1;i<=20;++i) { vector p=curve((float)i/20.0); total+=llVecDist(last,p); points+=[p]; lengths+=[total]; last=p; } float wanted=total*FRACTION; integer at=1; while(at<20&&llList2Float(lengths,at)0.000001)mix=(wanted-low)/span; vector first=llList2Vector(points,at-1); llOwnerSay("Approximate point="+(string)(first+(llList2Vector(points,at)-first)*mix)); } }