POV-Ray : Newsgroups : povray.general : Explain this! : Re: Explain this! Server Time
11 Aug 2024 23:24:52 EDT (-0400)
  Re: Explain this!  
From: Stephen Lavedas
Date: 26 Apr 1999 01:25:56
Message: <3723EAEE.B129EECB@virginia.edu>
btw, you only seem to put semi-colons after declares that aren't structs
of some kind.  I've run into errors putting semicolons after #declares
of vectors for instance.  It just seems to be the way the language
works.  A rather interesting erm... "feature" if you ask me.

Steve


Margus Ramst wrote:
> 
> I wonder if somebody can explain the following behaviour:
> 
> //Return 0 if not parallel, 1 if parallel, -1 if anti-parallel
> #macro t_parallel(V1i,V2i)
>     #local V1=vnormalize(V1i);
>     #local V2=vnormalize(V2i);
>     #local Vt=vlength(V1+V2)-1;
>     #if(abs(Vt)=1) Vt
>     #else 0
>     #end
> #end
> 
> //this works:
> #debug concat("Parallel is ",str(t_parallel(y,x),0,3),"\n")
> 
> //this returns an error:
> #if(t_parallel(y,x)=1|t_parallel(y,x)=-1)
> #debug "Parallel or anti-parallel\n"
> #else
> #debug "Not parallel\n"
> #end
> 
> //this works:
> #if(abs(t_parallel(y,x))=1)
> #debug "Parallel or anti-parallel\n"
> #else
> #debug "Not parallel\n"
> #end
> 
> //this also works, but _only_ when there is no semi-colon after the float
> declaration
> 
> #declare A=t_parallel(y,x) //no semi-colon!
> #if(A=1|A=-1)
> #debug "Parallel or anti-parallel\n"
> #else
> #debug "Not parallel\n"
> #end


Post a reply to this message

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