POV-Ray : Newsgroups : povray.text.scene-files : Color Wheel macro Server Time
28 Mar 2024 11:21:50 EDT (-0400)
  Color Wheel macro (Message 1 to 2 of 2)  
From: B  Gimeno
Subject: Color Wheel macro
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

From: Mike the Elder
Subject: Re: Color Wheel macro
Date: 23 Aug 2011 07:30:00
Message: <web.4e538f3293efb07f85627c70@news.povray.org>
"B. Gimeno" <nomail@nomail> wrote:
> /*
> Takes a pigment as input and returns the pigment placed at A degrees in the
> chromatic wheel
>
Nifty! Thanks for sharing this. My compliments to your complements.

Best Regards,
Mike C.


Post a reply to this message

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