POV-Ray : Newsgroups : povray.advanced-users : Implicit loops in function(x,y,z) : Re: Implicit loops in function(x,y,z) Server Time
3 Jul 2024 04:34:26 EDT (-0400)
  Re: Implicit loops in function(x,y,z)  
From: Warp
Date: 14 Jul 2008 15:05:33
Message: <487ba37d@news.povray.org>
slehar <sle### [at] gmailcom> wrote:
> So it seems you can't do logical tests on the values of the parameters in a
> function either!

  Any #-command is SDL. Any SDL-declared identifier is SDL. You can't use
them in functions (except to build the function body).

> #declare densityfunc = function(px,py,pz) {
>   #if(px > 0 | py < 0)
>     atan2(py,px)
>   #else
>     pi - atan2(py,px)
>   #end
> }

  Why would you want to use two versions of atan2(), given that it works
with all possible values of the parameters?

  Anyways, the user-defined function syntax has a function called select()
which you can use to test for conditions and select different functions
depending on them.

-- 
                                                          - Warp


Post a reply to this message

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