POV-Ray : Newsgroups : povray.general : Explain this! : Explain this! Server Time
14 Nov 2024 23:19:57 EST (-0500)
  Explain this!  
From: Margus Ramst
Date: 25 Apr 1999 12:55:48
Message: <37233b04.0@news.povray.org>
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.