// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Convert a hue wheel setting into RGB // Not compiled or tested in-world // Setup: Use a spare owned prim. Set HUE, SATURATION and VALUE; latter two in0..1. Touch for owner-only numeric output. // Stop / restore: Remove/disable; no colors or materials are applied. // Notes: Hue wraps cyclically. The calculation uses HSV, whose equal value is not equal perceived brightness. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Color calculation only. float HUE=145.0; float SATURATION=0.7; float VALUE=0.8; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(SATURATION<0.0||SATURATION>1.0||VALUE<0.0||VALUE>1.0) { llOwnerSay("Saturation/value must be0..1."); return; } float h=HUE/60.0; h-=6.0*llFloor(h/6.0); float c=VALUE*SATURATION; float rem=h-2.0*llFloor(h/2.0); float x=c*(1.0-llFabs(rem-1.0)); vector rgb; if(h<1.0)rgb=; else if(h<2.0)rgb=; else if(h<3.0)rgb=<0.0,c,x>; else if(h<4.0)rgb=<0.0,x,c>; else if(h<5.0)rgb=; else rgb=; float m=VALUE-c; llOwnerSay("RGB="+(string)(rgb+)); } }