POV-Ray : Newsgroups : povray.general : How to quick filling an array : How to quick filling an array Server Time
29 Jul 2024 10:28:37 EDT (-0400)
  How to quick filling an array  
From: H  Karsten
Date: 6 Oct 2011 19:30:00
Message: <web.4e8e3901b22b0664a3bfeb720@news.povray.org>
Hi people,

I've defined an array, like this:

#declare Detail=40;
#declare VoxelSpace=array[Detail+1][Detail+1][Detail+1];

to fill it, I did this:

#debug "Filling...\n"
#declare YI=0;
 #while (YI<Detail)
 #declare ZI=0;
 #while (ZI<Detail)
  #declare XI=0;
   #while (XI<Detail)
     #declare VoxelSpace[XI][YI][ZI]=0;
   #declare XI=XI+1;
   #end
  #declare ZI=ZI+1;
  #end
 #declare YI=YI+1;
 #end

to fill an array on initialising-time, using "Array Initializers" the docs give
me something like this:

#declare Digits =
 array[4][10]
 {
  {7,6,7,0,2,1,6,5,5,0},
  {1,2,3,4,5,6,7,8,9,0},
  {0,9,8,7,6,5,4,3,2,1},
  {1,1,2,2,3,3,4,4,5,5}
 }


Is there a way to fill an array, using only ONE line, saying that ALL values are
=0?

Best rgds,
Holger


Post a reply to this message

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