POV-Ray : Newsgroups : povray.general : pipe_spline and color : Re: pipe_spline and color Server Time
31 Oct 2024 19:49:46 EDT (-0400)
  Re: pipe_spline and color  
From: Alex
Date: 30 Nov 2015 15:35:01
Message: <web.565cb229e2db23c8f6cc3ced0@news.povray.org>
Thanks, guys, I'll try that!
- Alex



Thomas de Groot <tho### [at] degrootorg> wrote:
> 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.