POV-Ray : Newsgroups : povray.newusers : Array coding problem : Array coding problem Server Time
18 Apr 2024 23:46:37 EDT (-0400)
  Array coding problem  
From: AQ
Date: 20 Sep 2016 11:39:11
Message: <06l2ub10339pagp3g18ljmaqimjnlc3ni8@4ax.com>
I want to fill a 6 by 3 array with either a 0 or a 1 chosen at random
and then use these values in a colour map.  I thought it would be easy
but the code below gives an error and I cannot see why.  

#declare Col = array[7][4]
#for (j,0,6,1)
  #for (k,1,3,1)
    Col[j][k] = int(2*rand(R))
  #end
#end  
.
When I run the code I get the messagePrese

"C:\Povray\Harmonograph\Harmonograph 12.pov" line 62: Parse Error:
Attempt to access uninitialized array element.

But I thought I had initialised it !!

I was planning to us the values in a colour map like this 

colour_map {
              [0.0/6  rgb < Col[0,1], Col[0,2], Col[0,3] >]        
              [1.0/6  rgb < Col[1,1], Col[1,2], Col[1,3] >] 
              [2.0/6  rgb < Col[2,1], Col[2,2], Col[2,3] >] 
              [3.0/6  rgb < Col[3,1], Col[3,2], Col[3,3] >] 
              [4.0/6  rgb < Col[1,1], Col[4,2], Col[4,3] >] 
              [5.0/6  rgb < Col[5,1], Col[5,2], Col[5,3] >] 
              [6.0/6  rgb < Col[6,1], Col[6,2], Col[6,3] >]
            }

Any suggestions please

John


Post a reply to this message

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