POV-Ray : Newsgroups : povray.text.scene-files : Color Wheel macro : Color Wheel macro Server Time
19 Jun 2024 05:32:01 EDT (-0400)
  Color Wheel macro  
From: B  Gimeno
Date: 23 Aug 2011 04:05:00
Message: <web.4e535ea751de1471e27239330@news.povray.org>
/*
Takes a pigment as input and returns the pigment placed at A degrees in the
cromatic wheel

 pigment {CW_angle(Red,180}

*/
#macro CW_angle (COLOR,A)
   #local RGBFT = color COLOR;
   #local R = (RGBFT.red);
   #local G = (RGBFT.green);
   #local B = (RGBFT.blue);
   #local Min = min(R,min(G,B));
   #local Max = max(R,max(G,B));
   #local Span = Max-Min;
   #local H = CRGB2H (<R,G,B>, Max, Span);
   #local S = 0; #if (Max!=0) #local S = Span/Max; #end

   #local P = <H+A,S,Max,(RGBFT.filter),(RGBFT.transmit)> ;

   #local HSVFT = color P ;
   #local H = (HSVFT.red);
   #local S = (HSVFT.green);
   #local V = (HSVFT.blue);
   #local SatRGB = CH2RGB(H);
   #local RGB = ( ((1-S)*<1,1,1> + S*SatRGB) * V );
   rgb <RGB.red,RGB.green,RGB.blue,(HSVFT.filter),(HSVFT.transmit)>
#end


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.