POV-Ray : Newsgroups : povray.general : A macro that drops a vector-- what's the syntax again? : Re: A macro that drops a vector-- what's the syntax again? Server Time
1 Aug 2024 16:25:46 EDT (-0400)
  Re: A macro that drops a vector-- what's the syntax again?  
From: Alain
Date: 12 Nov 2005 14:44:51
Message: <43764633$1@news.povray.org>
Greg M. Johnson nous apporta ses lumieres en ce 2005-11-11 21:39:
> Greg M. Johnson wrote:
> 
> 
>  Oi vey!  Too much late-night coding, I guess.  :-S
> 
> Yes, that's an abs() function.  I wanted a sign() function and so was
> writing my own.
> 
> Perhaps it was late-night delusions, but I did think that povray 3.5 (the
> apt-get version) was freaking with me when it came to nested function/macro
> calls. 
> 
> 
> 
>>I cannot get the following code to work:
>>
>>//-----------------------------
>>#macro sign(a)
>>#if (a<0)
>>        (-a)
>>#else
>>        (a)
>>#end
>>#end
a sign() function return 1 if >0, -1 if <0 and 0 if =0.
It should look like:
#macro sign(a)
#if(a<0) #local S=-1;
  #else #if(a>0) #local S=1;
   #else #local S=0;
   #end
  #end
(S) // return the result
#end

-- 
Alain
-------------------------------------------------
After any salary raise, you will have less money at the end of the month than you did
before.


Post a reply to this message

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