|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I'm in the proccess of making a site for POV-fest 99, to you guys out
there just relax for the mean time...
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I keep posting messages to the wrong thread....
This message should go under the "Festival of POV" thread below.
ARGH!!!!!!!!!!!!!!!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I received a solution - the macro call has to be enclosed in parantheneses.
It seems this is necessary when the output data is within a conditional
block, e.g.
#macro A(B) #if(B=B) (B) #end #end
Another way to solve the problem is to add parantheneses in the macro:
#macro A(B) (#if(B=B) (B) #end) #end
Still, I would like to know the reason for this behaviour.
Margus
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
|
|