POV-Ray : Newsgroups : povray.off-topic : povray function thingy(a,b,c,d) Server Time
11 Oct 2024 01:22:31 EDT (-0400)
  povray function thingy(a,b,c,d) (Message 1 to 4 of 4)  
From: Greg M  Johnson
Subject: povray function thingy(a,b,c,d)
Date: 24 Jan 2008 22:55:43
Message: <47995dbf@news.povray.org>
If a>b, it's c, else it's evaluated as d.

I cannot find this function. what's it' called?


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: povray function thingy(a,b,c,d)
Date: 24 Jan 2008 23:14:06
Message: <4799620e@news.povray.org>

> If a>b, it's c, else it's evaluated as d.
> 
> I cannot find this function. what's it' called?

select?


Post a reply to this message

From: Greg M  Johnson
Subject: Re: povray function thingy(a,b,c,d)
Date: 24 Jan 2008 23:29:52
Message: <479965c0@news.povray.org>
Nicolas Alvarez wrote:

> Greg M. Johnson escribió:
>> If a>b, it's c, else it's evaluated as d.
>> 
>> I cannot find this function. what's it' called?
> 
> select?

Thanks.
I went and tried a #macro anyway, and it doesn't work.



#macro hiloer(jay)
#if (jay<0.5)
        (0+0.5*(1-sqrt(1-jay*jay*4))
#else
(0+jay)
#end
#end




#declare n=0;
#while (n<1)

#declare aya=(hiloer(n)):
        sphere{<n,3*n*n-2*n*n*n   ,3>,0.01 pigment{red 1} finish{ambient 1}}
        sphere{<n,0.5+0.5*cos(pi+n*pi),3>,0.01 pigment{green 1} finish{ambient 1}}
        sphere{<n,sqrt(1-n*n)       , 3>,0.01 pigment{rgb 1} finish{ambient 1}}
        sphere{<n,(hiloer(n))        , 3>,0.01 pigment{rgb 1} finish{ambient 1}}
 #declare n=n+0.001;
#end


Post a reply to this message

From: Warp
Subject: Re: povray function thingy(a,b,c,d)
Date: 25 Jan 2008 03:05:26
Message: <47999846@news.povray.org>
Greg M. Johnson <pte### [at] thecommononethatstartswithycom> wrote:
> I went and tried a #macro anyway, and it doesn't work.

  It does if you write it right.

#macro hiloer(jay)
    #if (jay<0.5)
        #local result = (0+0.5*(1-sqrt(1-jay*jay*4));
    #else
        #local result = (0+jay);
    #end
    result
#end

  Of course an alternative way of doing the same thing is:

#macro hiloer(jay)
    ((jay<0.5) ?(0+0.5*(1-sqrt(1-jay*jay*4)) : (0+jay)
#end

-- 
                                                          - Warp


Post a reply to this message

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