POV-Ray : Newsgroups : povray.beta-test : Sign()? Conditional expression? Server Time
29 Jul 2024 12:30:07 EDT (-0400)
  Sign()? Conditional expression? (Message 1 to 4 of 4)  
From: Greg M  Johnson
Subject: Sign()? Conditional expression?
Date: 24 May 2002 08:10:32
Message: <3cee2db8$1@news.povray.org>
As we get closer to the wire, it's possible my questions are getting dumber,
BUT:

1) I don't see a sign () function:  did we let a whole new release slip by
without this addition?

2) I tried to use a conditional expression in a parametric but it didn't
work.  They work as declared variables but not as an expression in a
parametric


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Sign()? Conditional expression?
Date: 24 May 2002 08:37:10
Message: <3cee33f6@news.povray.org>
> 1) I don't see a sign () function:  did we let a whole new release slip by
> without this addition?

For ___example___:

#macro sign(foo)
    select(foo, -1, 1)
#macro

#macro sign(foo)
    #if(foo >= 0)
        1
    #else
        -1
    #end
#end

> 2) I tried to use a conditional expression in a parametric but it didn't
> work.  They work as declared variables but not as an expression in a
> parametric

You have to be careful when using them.  they don't work like they did in
MegaPOV where they are not real conditionals but simply special versions of
min and max.

    Thorsten


Post a reply to this message

From: Christoph Hormann
Subject: Re: Sign()? Conditional expression?
Date: 24 May 2002 08:53:07
Message: <3CEE37B3.B08CA36D@gmx.de>
"Greg M. Johnson" wrote:
> 
> As we get closer to the wire, it's possible my questions are getting dumber,
> BUT:
> 
> 1) I don't see a sign () function:  did we let a whole new release slip by
> without this addition?

from math.inc:

#declare sgn = function (V) {select(V,-1, 0, 1)}

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 05 May. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Sign()? Conditional expression?
Date: 24 May 2002 09:50:18
Message: <3cee451a@news.povray.org>
doh?


Post a reply to this message

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