// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Frame a flat artwork with a perspective view // Not compiled or tested in-world // Setup: Use a spare owned prim. Set width/height, vertical FOV and aspect ratio. Touch for private calculations. // Stop / restore: Disable/remove. No camera or object settings are changed. // Notes: The artwork must face the camera directly. Unlike spherical fitting, it uses tangent rather than sine. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Transform planning only. float WIDTH=6.0; float HEIGHT=4.0; float VERTICAL_FOV=50.0; float ASPECT=1.7777778; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(WIDTH<=0.0||HEIGHT<=0.0||VERTICAL_FOV<=1.0||VERTICAL_FOV>=170.0||ASPECT<=0.0) { llOwnerSay("Invalid inputs."); return; } float t=llTan(VERTICAL_FOV*DEG_TO_RAD*0.5); float d=HEIGHT*0.5/t; float horizontal=WIDTH*0.5/(t*ASPECT); if(horizontal>d)d=horizontal; llOwnerSay("Minimum frontal distance="+(string)d); } }