POV-Ray : Newsgroups : povray.newusers : Using conditional expression in functions. How to write step functions? : Re: Using conditional expression in functions. How to write step functions? Server Time
8 Jul 2024 01:33:03 EDT (-0400)
  Re: Using conditional expression in functions. How to write step functions?  
From: Tor Olav Kristensen
Date: 18 Dec 2009 19:10:00
Message: <web.4b2c1926be6ce51da049a19e0@news.povray.org>
"Evgenij Gagauz" <nomail@nomail> wrote:
> Is there a way to use an conditional expression in function?
>
> For example, how can I write something like that (the code isn't compilable):
> #local  =
> function(a) {
>   #if (a < .1)
>     1
>   #else
>     0
>   #end
> }

#declare StepFn = function(A) { select(A - 0.1, 1, 0) }

--
Tor Olav
http://subcube.com


Post a reply to this message

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