// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Check a two-link display arm reach // Not compiled or tested in-world // Setup: Put in a spare owned prim. Set lengths L1/L2 and target X/Y. Owner touch prints calculations only. // Stop / restore: Disable/remove. No prim motion or appearance is changed. // Notes: Returns one elbow configuration. Singular and unreachable targets are reported; this does not control a rig or avatar. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Motion planning only. float L1=3.0; float L2=2.0; float X=3.0; float Y=2.0; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(L1<=0.0||L2<=0.0) { llOwnerSay("Positive lengths required."); return; } float d2=X*X+Y*Y; float c=(d2-L1*L1-L2*L2)/(2.0*L1*L2); if(c< -1.0||c>1.0||d2<0.000001) { llOwnerSay("Unreachable or singular target."); return; } float elbow=llAcos(c); float shoulder=llAtan2(Y,X)-llAtan2(L2*llSin(elbow),L1+L2*llCos(elbow)); llOwnerSay("Shoulder degrees="+(string)(shoulder*RAD_TO_DEG)+" elbow degrees="+(string)(elbow*RAD_TO_DEG)); } }