|
|
|
|
|
|
| |
| |
|
|
From: Jaap Frank
Subject: Multi dimensional arrays (dim>5) and multi variable type arrays
Date: 13 Jul 2003 10:40:59
Message: <3f116f7b$1@news.povray.org>
|
|
|
| |
| |
|
|
Maybe this is already known, but it might be handy for someone.
If you want a very high dimensional array, this can be done.
Further you can extract a peace of an array.
// --------- Start of code ----------------------------------------
#declare A = array[2][2][2]
#declare B = array[2][2][2]
#declare C = array[2][2][2]
// Connect the arrays
#declare B[0][0][0] = C
#declare A[0][0][0] = B
// Initiate something
#declare A[0][0][0][0][0][0][0][0][0]=0.345;
// Extract a piece
#declare D = A[0][0][0][0][0][0]
//#declare E = A[0][0][0][0][0] //<-- this gives an error of coarse
#debug str(A[0][0][0][0][0][0][0][0][0],5,3)
// ------- End of code -----------------------------------------
Amazingly POV does not get confused!!
This way it is also possible to put different things into one total array.
In one subarray you can put objects and in other subarrays some
different kind of variables.
So you can build your own multi variable type array.
// --------- Start of code ----------------------------------------
#declare Total = array[3]
#declare Objects = array[2]
#declare Tex = array[2]
{pigment{color rgb <0,1,0>},
pigment{color rgbt <1,1,1,0.4>} }
#declare Vars = array[4]{0,1, -1, +1}
#declare Total[0] = Objects
#declare Total[1] = Vars
#declare Total[2] = Tex
#declare Total[0][0] =
sphere{ Total[1][0], Total[1][1]
texture { Total[2][0]}}
#declare Total[0][1] =
box{ Total[1][2], Total[1][3]
texture { Total[2][1]}}
object {Total[0][0]}
object {Total[0][1]}
light_source { <-20, 40, -20> color rgb <1,1,1> }
camera { location <0,0,-3> look_at 0 }
// ------- End of code -----------------------------------------
Maybe someone can use this someway.
Jaap Frank
Post a reply to this message
|
|
| |
| |
|
|
From: gonzo
Subject: Re: Multi dimensional arrays (dim>5) and multi variable type arrays
Date: 13 Jul 2003 15:52:23
Message: <3f11b877$1@news.povray.org>
|
|
|
| |
| |
|
|
Jaap Frank <jjf### [at] xs4allnl> wrote in message
news:3f116f7b$1@news.povray.org...
> Maybe this is already known, but it might be handy for someone.
>
> If you want a very high dimensional array, this can be done.
> Further you can extract a peace of an array.
>
> // --------- Start of code ----------------------------------------
> #declare A = array[2][2][2]
> #declare B = array[2][2][2]
> #declare C = array[2][2][2]
> // Connect the arrays
> #declare B[0][0][0] = C
> #declare A[0][0][0] = B
> // Initiate something
> #declare A[0][0][0][0][0][0][0][0][0]=0.345;
> // Extract a piece
> #declare D = A[0][0][0][0][0][0]
This is basically what I did for my Architecture IRTC entry
http://www.irtc.org/ftp/pub/stills/2003-04-30/rows_rg.jpg ) except I did it
the hard way of coding everything in line;
#declare A= array [some_variable]
{
array [another_array[0]] {...array data...},
array [another_array[1]] {...array data...},
array [another_array[2]] {...array data...}
}
I never thought to pre-declare the arrays and connect them like you did.
Your way looks like it has a lot more flexibility. I ended up with around
15 large complex arrays. By pre-declaring the smaller arays I could have
probably built a lot of them on the fly using loops and reading the data
from a file. Thanks for the input, I'll definitely remember that next time
I need to do something similar!
>
> Amazingly POV does not get confused!!
No, but I sure did! It took me most of the two months of the round figuring
out what needed to get where!
> This way it is also possible to put different things into one total array.
> In one subarray you can put objects and in other subarrays some
> different kind of variables.
> So you can build your own multi variable type array.
Yes, and the arrays can be different sizes, while a normal multi-dimensional
array all dimensions have to be the same. Another advantage (and the main
reason I did it this way!) is you can then pass one dimension of the array
to a macro, since in a normal multi-dimensional array POV does not permit
referencing only one dimension.
This isn't allowed;
#declare Objects = array [n][m] {...n+m stuff...}
MyMacro( Objects[n] )
While this is;
#declare Objects = array [n]{...n arrays...}
MyMacro( Objects[n] )
The POV master gurus probably already know this, but for a mere mortal like
myself this was a major breakthru!
Thanks for adding your .02!
RG
Post a reply to this message
|
|
| |
| |
|
|
From: Jaap Frank
Subject: Re: Multi dimensional arrays (dim>5) and multi variable type arrays
Date: 13 Jul 2003 16:38:06
Message: <3f11c32e$1@news.povray.org>
|
|
|
| |
| |
|
|
"gonzo" <rgo### [at] lansetcom> wrote in message news:3f11b877$1@news.povray.org...
>
> This is basically what I did for my Architecture IRTC entry
> http://www.irtc.org/ftp/pub/stills/2003-04-30/rows_rg.jpg ) except I did it
> the hard way of coding everything in line;
Nice picture that is. Gives me the impression of a lazy sunday afternoon
somewhere in september.
> I never thought to pre-declare the arrays and connect them like you did.
> Your way looks like it has a lot more flexibility. I ended up with around
> 15 large complex arrays. By pre-declaring the smaller arays I could have
> probably built a lot of them on the fly using loops and reading the data
> from a file. Thanks for the input, I'll definitely remember that next time
> I need to do something similar!
I've used it before as well, but when I reread the manual today about the
array definition (and his limitations), it suddingly occured to me that it
could be done the way I described it. With a small test file it was quickly
demonstrated. I couldn't resist to share it with everyone.
> The POV master gurus probably already know this, but for a mere mortal like
> myself this was a major breakthru!
> Thanks for adding your .02!
Your welcome.
Maybe I should place it in 'povray.newusers' as well. What do you think?
Jaap Frank
Post a reply to this message
|
|
| |
| |
|
|
From: gonzo
Subject: Re: Multi dimensional arrays (dim>5) and multi variable type arrays
Date: 14 Jul 2003 16:59:32
Message: <3f1319b4@news.povray.org>
|
|
|
| |
| |
|
|
Jaap Frank <jjf### [at] xs4allnl> wrote in message
news:3f11c32e$1@news.povray.org...
> Nice picture that is. Gives me the impression of a lazy sunday afternoon
> somewhere in september.
Thanks!
> Maybe I should place it in 'povray.newusers' as well. What do you think?
Heh heh, probably a good place, since I'm not even sure what I'm doing
reading the advanced user posts! Half the stuff I read in here I don't
understand!
RG - but then again, from the other half I learn a lot!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Sun, 13 Jul 2003 16:43:38 +0200, "Jaap Frank" <jjf### [at] xs4allnl> wrote:
> If you want a very high dimensional array, this can be done.
> Further you can extract a peace of an array.
Other interesting issue at http://news.povray.org/povray.advanced-users/19907/
ABX
Post a reply to this message
|
|
| |
| |
|
|
From: Jaap Frank
Subject: Re: Multi dimensional arrays (dim>5) and multi variable type arrays
Date: 15 Jul 2003 09:07:25
Message: <3f13fc8d$1@news.povray.org>
|
|
|
| |
| |
|
|
"ABX" <abx### [at] abxartpl> wrote in message
news:jif7hvgocdvhqgdd18emb1ebhufcvsnhpl@4ax.com...
> On Sun, 13 Jul 2003 16:43:38 +0200, "Jaap Frank" <jjf### [at] xs4allnl> wrote:
> > If you want a very high dimensional array, this can be done.
> > Further you can extract a peace of an array.
>
> Other interesting issue at http://news.povray.org/povray.advanced-users/19907/
>
> ABX
It seems that I re-invented the wheel.
Maybe this should be entered in the manual. Your example is short
and guides to the way one can use this.
I've posted a small explanation in 'povray.text.tutorials' so more
people can learn it. Not everybody reads the advanced users.
Jaap Frank
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|