// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Convert vertical and horizontal field of view // Not compiled or tested in-world // Setup: Use a spare owned prim. Set vertical degrees and positive ASPECT. Touch for private calculations. // Stop / restore: Disable/remove. No camera or object settings are changed. // Notes: Uses a symmetric perspective projection. Diagonal FOV is also reported for planning. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Transform planning only. float VERTICAL_FOV=60.0; float ASPECT=1.7777778; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(VERTICAL_FOV<=1.0||VERTICAL_FOV>=170.0||ASPECT<=0.0) { llOwnerSay("Invalid view parameters."); return; } float t=llTan(VERTICAL_FOV*DEG_TO_RAD*0.5); llOwnerSay("Horizontal FOV="+(string)(2.0*llAtan2(t*ASPECT,1.0)*RAD_TO_DEG)+" diagonal FOV="+(string)(2.0*llAtan2(t*llSqrt(1.0+ASPECT*ASPECT),1.0)*RAD_TO_DEG)); } }