// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Tangent points from an outside anchor // Not compiled or tested in-world // Setup: Place in a spare prim. Set circle CENTER, RADIUS, and exterior POINT in the same XY plane. Owner touch prints results without altering the scene. // Stop / restore: Disable or remove. No prim properties are changed. // Notes: The point must lie strictly outside the circle. Useful for straight paths meeting a circular border smoothly. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Owner-only calculation. vector CENTER=<0.0,0.0,0.0>; vector POINT=<8.0,3.0,0.0>; float RADIUS=3.0; default { touch_start(integer detectedCount) { if (llDetectedKey(0)!=llGetOwner()) return; vector delta=POINT-CENTER; delta.z=0.0; float d2=delta*delta; if(RADIUS<=0.0||d2<=RADIUS*RADIUS) { llOwnerSay("Point must be outside a positive-radius circle."); return; } float a=RADIUS*RADIUS/d2; float b=RADIUS*llSqrt(d2-RADIUS*RADIUS)/d2; vector perpendicular=<-delta.y,delta.x,0.0>; llOwnerSay("Tangent points: "+(string)(CENTER+a*delta+b*perpendicular)+" and "+(string)(CENTER+a*delta-b*perpendicular)); } }