POV-Ray : Newsgroups : povray.general : keeping functions from looping : Re: keeping functions from looping Server Time
29 Jul 2024 08:21:23 EDT (-0400)
  Re: keeping functions from looping  
From: Zeger Knaepen
Date: 25 Feb 2012 19:21:25
Message: <4f497b05$1@news.povray.org>
On 26/02/2012 0:30, ricky312 wrote:
> I am having trouble with function "looping" they go from rgb 0 to rgb 1 and
> repeat over again. is there a way to keep it from doing that with out dividing
> the function's "power".
> thank you in advance.


#declare noWrap=function(x) {max(min(x,1),0)}

//now you can do things like:

#declare repeatingFunction=function {x}
#declare nonRepeatingFunction=function{noWrap(repeatingFunction(x))}

//or, very usefull with pigment functions:

#declare troublesomeFunction=function {pigment {image_map {png 
"yourpng.png" interpolate 2}}}

#declare 
notSoTroublesomeFunction_Red=function{noWrap(troublesomeFunction(x,y,z).red)}



Hope this helps!  Don't really know what you mean by "dividing the 
function's power" though, so maybe this is of no use at all to you :)
-- 
ZK


Post a reply to this message

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