|
|
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
|
|