POV-Ray : Newsgroups : povray.general : 3.1 array bug? : 3.1 array bug? Server Time
13 Aug 2024 17:26:37 EDT (-0400)
  3.1 array bug?  
From: PoD
Date: 24 Jul 1998 15:08:48
Message: <35B8CDA0.39CE@merlin.net.au>
POV-Ray 3.1 beta seems to have trouble initialising arrays of more than
2 dimensions.  It appears that the 'most significant' dimension index in
a 3D array is not incremented when reading the initialising data.

Here's a script which demonstrates what I'm talking about.

-----------------------------begin POV
code-----------------------------------
// This 3D array does not get initialised properly
// Only the last row is read into the array
// and the values are put where those in the first row should be ie.
A[0][0..2][0..2]
// it seems that the data are overwritten
#declare A = array[3][3][3]
{
	{
		{0,1,2},{3,4,5},{6,7,8}
	},
	{
		{9,10,11},{12,13,14},{15,16,17}
	},
	{
		{18,19,20},{21,22,23},{24,25,26}
	}
}

// uncomment the line below to initialise array
//#declare Init = on;
#ifdef(Init)
#declare I = 0; #while(I < 27)
	#declare X = mod(I,3);
	#declare Y = mod(I/3,3);
	#declare Z = mod(I/9,3);
	#declare A[Z][Y][X] = I;
	#declare I = I + 1;#end
#end

// Read the values and send them to the DEBUG stream
#declare I = 0; #while(I < 27)
	#declare X = mod(I,3);
	#declare Y = mod(I/3,3);
	#declare Z = mod(I/9,3);
	#declare N = A[Z][Y][X];
	#debug concat( "I = ",str(I,2,0),", N = ",str(N,2,0),"\n")
	#declare I = I + 1;#end
------------------------------end POV
code-----------------------------------


Cheers, PoD.


Post a reply to this message

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