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: Christopher James Huff
Date: 5 Aug 2003 15:12:11
Message: <cjameshuff-118111.14103705082003@netplex.aussie.org>
In article <web.3f2ff7b7cfc89a807196f5900@news.povray.org>,
 "Dave Matthews" <mat### [at] dinecollegeedu> wrote:

> 1.  If, inside a function, x, y and z are components of some vector, what's
> the name of the vector?  (So I can do a myvector.x in the #if statement.)

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/


Post a reply to this message

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