POV-Ray : Newsgroups : povray.general : pipe_spline and color : Re: pipe_spline and color Server Time
31 May 2024 20:56:23 EDT (-0400)
  Re: pipe_spline and color  
From: Thomas de Groot
Date: 30 Nov 2015 02:51:39
Message: <565c000b$1@news.povray.org>
On 29-11-2015 23:41, Alain wrote:

>> Hi Alain,
>>
>> That is precisely what I need. If I could make use of the length
>> parameter along
>> the spline, I could define the pigment at every such position. In the
>> short code
>> I posted, you can see in the #macro that the radius of my pipe_spline
>> is defined
>> by the parameter sClock - the radius is proportional to the position
>> along the
>> spline. I want to do the same thing for color, but it seems the
>> parameter sClock
>> does not work there. I suspect that it would be possible if I invoked the
>> parameter correctly.
>>
>> - Alex
>>
>>
>>
>>
>
> You can have something like:
> color_map{[0 rgb 1][sClock rgb<1,0,0>][1 rgb<0,1,1>]}
>
> with the value of sClock previously declared, as long as sClock range
> from 0 to 1, both inclusive.
>
> You may define additional splines that define your colours, say
> Colour_Spline. That way, you can use:
>
> #declare Something = pigment{rgb Colour_Spline[sClock]}
> or
> #declare Something = pigment{rgbft<Red_Spline[sClock],
> Green_Spline[sClock], Blue_Spline[sClock], Filter_Spline[sClock],
> Transmit_Spline[sClock]}
>
> Here, if sClock's value is outside the range of the spline, the result
> is taken at the nearest end.
>
> Then, it's possible to construct a colour_map in a loop:
>
> colour_map{
> #declare Point = 0;
> #while(Point <= 1)
>   [Point rgb Colour_Spline[Point]]
> #declare Point = Point + 0.01;
> #end
> }
>

Or, for a more aesthetic form ;-)

colour_map {
#for (Point, 0, 1, 0.01)
   [Point rgb Colour_Spline[Point]
#end
}


-- 
Thomas


Post a reply to this message

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