POV-Ray : Newsgroups : povray.beta-test : #include files in macros undefine the parameters : Re: #include files in macros undefine the parameters Server Time
29 Jul 2024 18:30:52 EDT (-0400)
  Re: #include files in macros undefine the parameters  
From: Tor Olav Kristensen
Date: 30 Mar 2002 13:54:58
Message: <3ca60a02$1@news.povray.org>
David Wallace <dar### [at] earthlinknet> wrote in message
news:3ca5c3aa@news.povray.org...
>...
> // point function
> #macro pnt(i, j, p, q)
>  #local rd = sin(i)*(sin(6*j)+1.1);
>   #local xp = rd*cos(j);
>   #local yp = cos(i);
>   #local zp = rd*sin(j);
>   #local dp = <9,2,9>*(1+fnDimp(xp,yp,zp)*.02);
>   #local pt0 = <xp,yp,zp>*dp;
>   #local pt1 = vrotate(pt0, y*rd*90);
>   pt1
> #end
>...

If you are returning a local variable that is either
a number or a vector from a macro, then I
recommend that you put brackets around it,
like this:

(pt1)

By doing so, you are avoiding problems with
this bug:

* Macro bug (job000146)

http://news.povray.org/povray.beta-test/22807/


Here's a direct link to the bug-report:

http://news.povray.org/povray.beta-test/18763/121582/


In your macro above, another way of avoiding
this bug, is to return this expression instead of
a local variable:

vrotate(pt0, y*rd*90)


Like this:


#macro pnt(i, j, p, q)

  #local rd = sin(i)*(sin(6*j)+1.1);
  #local xp = rd*cos(j);
  #local yp = cos(i);
  #local zp = rd*sin(j);
  #local dp = <9,2,9>*(1+fnDimp(xp,yp,zp)*.02);
  #local pt0 = <xp,yp,zp>*dp;

  vrotate(pt0, y*rd*90)

#end


And finally:

I recommend you to only use variable names
that have at least one capital letter in them.

IIRC this is because any/many lower case
words may be used as reserved words in
future POV versions.


Tor Olav


Post a reply to this message

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