|
![](/i/fill.gif) |
Thanks for the exhaustive reply. I was about to ask what one could do if one
had TWO variables, but I guess that I can simply turn my two 3D arrays into
one 6D array.
John VanSickle wrote:
> Greg M. Johnson wrote:
> > So, like how would you make your inc if you had two variables which
> > were [350][34] each?
> >
> > Would your file generator literally say:
> >
> > #declare position.x[1][1]=1;
> > #declare position.y[1][1]=2;
> > #declare position.z[1][1]=3;
> > #declare position.x[1][2]=4;
> > #declare position.y[1][2]=5;
> > #declare position.z[1][2]=6;
>
> No, the file generator can also dump out the following:
>
> #declare position=array[350][34] = {
> { <1,2,3>,<4,5,6>, ... }, {... }, ...
> }
>
> The PovRay code would look like this:
>
> // START OF SAMPLE BASIC CODE
>
> #write(MyFile,"#declare position=array[", ROWS, "][", COLUMNS, "] = {\n")
> #local iI=0; #while(iI<ROWS)
> #if (iI>0) #write(MyFile,",") #end
> #write(MyFile,"{ ")
> #local iJ=0; #while(iJ<COLUMNS)
> #if (iJ>0) #write(MyFile,",") #end
> #write(MyFile,MyDataArray[iI][iJ])
> #local iJ=iJ+1; #end
> #write(MyFile, " }\n" )
> #local iI=iI+1; #end
> #write(MyFile, "}\n" )
>
> // END OF SAMPLE CODE
>
> Your file generating program can print out the #declares, square
> brackets, angle brackets, squiggly brackets, commas, and so forth.
>
> The only difficulty is that if you want to have text data in there as
> well, you have to explicitly print out the quotes with the CHR$()
> function:
>
> #write(MyFile, "#declare MyString="; CHR$(34); "Stormbringer";
> CHR$(34); "\n")
>
> which will create a line of text that looks like this:
>
> #declare MyString="Stormbringer"
>
> You can feed a vector to the #write() directive as well; my example does.
>
> #write(MyFile,x-y+z*3)
>
> will cause the string
>
> < 1,-1, 3>
>
> to be written to MyFile. There is no need to bust up the vectors into
> scalars, only to build them back up later.
>
> Of course, keeping track of the brackets and quotation marks can be
> a bit of a trick. :-)
>
> Hope this helps,
> John
Post a reply to this message
|
![](/i/fill.gif) |