POV-Ray : Newsgroups : povray.newusers : Two meanings of x? : Re: Two meanings of x? Server Time
4 Nov 2024 13:04:08 EST (-0500)
  Re: Two meanings of x?  
From: Dave Matthews
Date: 5 Aug 2003 15:30:01
Message: <web.3f30053928b286237196f5900@news.povray.org>
Christopher James Huff wrote:

>It has no name. The x, y, and z values are float parameters to the
>function. And you seem to expect the #if() statement to execute when the
>function is run...it won't, it will execute when the function is defined.
>
>#declare Test = true;
>
>function {
>    #if(Test)
>        x*x + z*z
>    #else
>        y*y + z*z
>    #end
>}
>
>Is equivalent to:
>
>function {x*x + z*z}
>
>
>> 3.  If questions #1 and #2 make no sense, could someone tell me how to
>> reference x, y and z with #if statements inside a function, and maybe when
>> I see the correct syntax I'll figure out what's wrong with my thinking.
>> Like, how would I make a function that gives me, for example, x*x + y*y +
>> z*z - 4 if sin(x + y) < z and x*x - y*y otherwise (just to pull an example
>> out of thin air.)
>
>Look at the documentation for the select() function.
>
>Christopher James Huff <cja### [at] earthlinknet>
>http://home.earthlink.net/~cjameshuff/
>POV-Ray TAG: chr### [at] tagpovrayorg
>http://tag.povray.org/
>

OK.  About a dozen lightbulbs just came on.  When I stop blinking, I'll pour
over the select() function.  Thank you very much.

Your diagnosis "you seem to expect the #if() statement to execute when the
function is run" was absolutely true, and the basis for most of my
confusion.

Thanks again.

Dave Matthews


Post a reply to this message

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