|
|
Hei Kyrre!
If you put parenthesis around your macro result it will
stop acting strange.
Like this:
#macro intp(X,X1,Y1,X2,Y2)
((Y2-Y1)/(X2-X1)*X - (Y2-Y1)/(X2-X1)*X1 + Y1)
#end
The third parameter; Var1 (Y1) passed to your macro
will not be multiplied with (y+z) if you don't do this.
(If you omit the parenthesis, then Var1 is promoted to
a vector before it's added to a vector.)
Tor Olav
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html
Sigmund Kyrre Aas wrote:
> This code shows something I found the other day: a macro (intp) wich returns a
> number, affects the x-value when used in some vector expressions.
>
> At first I thought it was a bug in MegaPov, but it also shows up in
> POV-Ray 3.1e
>
> #macro intp(X,X1,Y1,X2,Y2)
> (Y2-Y1)/(X2-X1)*X - (Y2-Y1)/(X2-X1)*X1 + Y1
> #end
>
> ...
> #declare var1=.1;
> #declare var2=1;
>
> // this one adds var1*x
> #declare i=0;
> #while (i<=3)
> Print( x + (y+z)*intp(i, 0, var1, 3, var2) )
> #local i=i+1;
> #end
> #render "\n"
Post a reply to this message
|
|