POV-Ray : Newsgroups : povray.general : Math problem : Re: Math problem Server Time
12 Aug 2024 07:25:35 EDT (-0400)
  Re: Math problem  
From: Spider
Date: 15 Mar 1999 15:17:32
Message: <36ED6943.C5C3018A@bahnhof.se>
// initalize the array
 #macro InitGrid ()
   #local i = 0;
   #while ( i < 10 )
   #local j = 0;
//RESET J HERE !!!
     #while ( j < 10 )
       #declare MyGrid[i][j] = 1;
       #local j = j + 1;
     #end
     #local i = i + 1;
   #end
 #end
 
 #macro DrawGrid ()
   #local i = 0;
   #while (i < 10 )
//RESET J HERE !!!
   #local j = 0;
     #while ( j < 10 )
       sphere { <i*2,2,j*2> MyGrid[i][j]
                pigment { red 1 }
                finish { phong 1 } }
       #local j = j + 1;
     #end
     #local i = i + 1;
   #end
 #end
 

I set the comments. Sorry for screaming :-)
you only have to reinit J to 0 every outer loop, or it will only happen ince.
And, use #local inside a macro.
-- 
//Spider 
( spi### [at] bahnhofse ) [ http://www.bahnhof.se/~spider/ ]
#declare life = rand(seed(42))*sqrt(-1);


Post a reply to this message

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