POV-Ray : Newsgroups : povray.newusers : extracting x,y,z values in a macro : extracting x,y,z values in a macro Server Time
29 Jul 2024 22:29:09 EDT (-0400)
  extracting x,y,z values in a macro  
From: Max Ulbrich
Date: 22 Jan 2005 04:13:02
Message: <41f2191e$1@news.povray.org>
Hi,

I try to get a sum over an expression that contains data of an array. I 
try to use a macro for this purpose and later call this in the function 
part of the isosurface. In the part where I try to extract the x, y and 
z coordinates from the macro arguments something goes wrong. Although I 
do not get an error message, the x coordinate seems always to be 1.
It seems as if x gets evaluated before the call of the macro. Actually I 
would prefer to get this done just when the call happens. My guess is 
that macro isn't the right solution. Who can help me?
Thanks,
Max

#macro esum(posx,posy,posz)
   #local i=0;
   #local isum=0;
   #while (i<=arrcnt)
     #declare isum=isum+(1-1/(1+exp(-(sqrt(pow((posx.x-atmx[0])/vg,2)
                   +pow((posy.y-atmy[0])/vg,2)
                   +pow((posz.z-atmz[0])/vg,2))-v50/vg))));
     #declare i=i+1;
     #debug str(posx.x,1,0)
   #end
   #local imin=1-isum;
   imin
#end


isosurface {

   function { esum(x,y,z)  }
   contained_by {
     box { <26,-27,22>,<37,-34,27> }
   }
   threshold 0.5
   max_gradient 5
   pigment {Red}
  translate <-35,32,-24>
   scale 0.4

}


Post a reply to this message

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