// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Transform a tangent normal into a planned world frame // Not compiled or tested in-world // Setup: Use a spare owned prim. Set normalized perpendicular axes T/B/N and TANGENT_NORMAL. Touch for owner-only numeric output. // Stop / restore: Remove/disable; no colors or materials are applied. // Notes: The basis must be orthonormal; this example checks perpendicularity and normalizes axes. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Color calculation only. vector T=<1.0,0.0,0.0>; vector B=<0.0,0.7071068,0.7071068>; vector N=<0.0,-0.7071068,0.7071068>; vector TANGENT_NORMAL=<0.2,0.1,1.0>; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(llVecMag(T)<0.000001||llVecMag(B)<0.000001||llVecMag(N)<0.000001||llVecMag(TANGENT_NORMAL)<0.000001) { llOwnerSay("Nonzero vectors required."); return; } T=llVecNorm(T); B=llVecNorm(B); N=llVecNorm(N); if(llFabs(T*B)>0.001||llFabs(T*N)>0.001||llFabs(B*N)>0.001) { llOwnerSay("Axes must be perpendicular."); return; } vector local=llVecNorm(TANGENT_NORMAL); llOwnerSay("World normal="+(string)llVecNorm(local.x*T+local.y*B+local.z*N)); } }