POV-Ray : Newsgroups : povray.advanced-users : Macros acting strange : Re: Macros acting strange Server Time
30 Jul 2024 04:22:13 EDT (-0400)
  Re: Macros acting strange  
From: Sigmund Kyrre Aas
Date: 28 Mar 2000 16:32:20
Message: <38E124D8.33B8DF84@stud.ntnu.no>
Ah! Thanks. It's so easy to treat something like intp() like a function.

sig

Tor Olav Kristensen wrote:
> 
> 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

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