I know this is one of those perennial questions that must come up regularly, but I simply cannot figure it out. What's a good way to store data in a 3-dimensional array?
Thanks!
—t3db0t
On Fri, 28 Jan 2011, Tedb0t wrote:
I know this is one of those perennial questions that must come up regularly, but I simply cannot figure it out. What's a good way to store data in a 3-dimensional array?
[#store] supports 3-dimensional arrays, as well as 2-dimensional, 1-dimensional, 0-dimensional, 4-dimensional, 5-dimensional... apparently it can support up to 14-dimensional, but I never tried.
It's not arrays in exactly the same sense as in the base of pd, though.
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
I havn't tried store, but you can always use multiple arrays with the same index, IE (arrays) pos-X, pos-Y, pos-Z [counter] | \ [tabread pos-X] [tabread pos-Y] [tabread pos-Z] I know that ascii hasn't come across very well, but it basically translates to multiple dimentions called up by the same index
Date: Fri, 28 Jan 2011 13:20:41 -0500 From: matju@artengine.ca To: lists@liminastudio.com CC: pd-list@iem.at Subject: Re: [PD] Multi-dimensional arrays
On Fri, 28 Jan 2011, Tedb0t wrote:
I know this is one of those perennial questions that must come up regularly, but I simply cannot figure it out. What's a good way to store data in a 3-dimensional array?
[#store] supports 3-dimensional arrays, as well as 2-dimensional, 1-dimensional, 0-dimensional, 4-dimensional, 5-dimensional... apparently it can support up to 14-dimensional, but I never tried.
It's not arrays in exactly the same sense as in the base of pd, though.
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On Sat, 29 Jan 2011, Andrew Faraday wrote:
I havn't tried store, but you can always use multiple arrays with the same index, IE (arrays) pos-X, pos-Y, pos-Z I know that ascii hasn't come across very well, but it basically translates to multiple dimentions called up by the same index
Ok, I don't think Tedb0t meant that. In your case, you have multiple dimensions in the space in which you pick each "value". The normal meaning of "3-dimensional array" is an array in which the indices have three dimensions.
So, in your case, the data has 2 dimensions of indices, the latter dimension being used to pick X,Y,Z. if it's a numbered dimension, 0 may stand for X, 1 for Y, and 2 for Z.
In our case, if the first dimension of indices has 50 possibilities, and the 2nd has 240 possibilities, and the 3rd has 320 possibilities, there are 50*240*320 = 3840000 elements that need to be put somewhere, and I don't think we'd like to spread that over too many arrays.
"Your" concept of dimension is often called "channel" instead of "dimension" in GridFlow, such as the R,G,B channels of a colour picture (or Y,U,V channels, etc.). But many GridFlow object-classes don't know what's a channel, and don't need to know. In any case, a single structure contains all channels, numbered. Thus it's easy to have any number of channels, even a million.
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
Thanks for the responses everyone; I've been using gridflow and after a rocky start I've figured out what seems to be a pretty efficient solution, based around [#store] and [#many]. I'll be putting the patch up online very soon!
±±t3db0t
On Jan 29, 2011, at 10:27 AM, Mathieu Bouchard wrote:
On Sat, 29 Jan 2011, Andrew Faraday wrote:
I havn't tried store, but you can always use multiple arrays with the same index, IE (arrays) pos-X, pos-Y, pos-Z I know that ascii hasn't come across very well, but it basically translates to multiple dimentions called up by the same index
Ok, I don't think Tedb0t meant that. In your case, you have multiple dimensions in the space in which you pick each "value". The normal meaning of "3-dimensional array" is an array in which the indices have three dimensions.
So, in your case, the data has 2 dimensions of indices, the latter dimension being used to pick X,Y,Z. if it's a numbered dimension, 0 may stand for X, 1 for Y, and 2 for Z.
In our case, if the first dimension of indices has 50 possibilities, and the 2nd has 240 possibilities, and the 3rd has 320 possibilities, there are 50*240*320 = 3840000 elements that need to be put somewhere, and I don't think we'd like to spread that over too many arrays.
"Your" concept of dimension is often called "channel" instead of "dimension" in GridFlow, such as the R,G,B channels of a colour picture (or Y,U,V channels, etc.). But many GridFlow object-classes don't know what's a channel, and don't need to know. In any case, a single structure contains all channels, numbered. Thus it's easy to have any number of channels, even a million.
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
On Fri, Jan 28, 2011 at 01:15:18PM -0500, Tedb0t wrote:
I know this is one of those perennial questions that must come up regularly, but I simply cannot figure it out. What's a good way to store data in a 3-dimensional array?
You can use three arrays, of coruse, or one and write your data in groups of three. The latter approach is attached.
Frank Barknecht Do You RjDj.me? _ ______footils.org__
On Sat, 29 Jan 2011, Frank Barknecht wrote:
On Fri, Jan 28, 2011 at 01:15:18PM -0500, Tedb0t wrote:
I know this is one of those perennial questions that must come up regularly, but I simply cannot figure it out. What's a good way to store data in a 3-dimensional array?
You can use three arrays, of coruse, or one and write your data in groups of three. The latter approach is attached.
See my previous mail (a few minutes ago) so that you learn what is normally meant when one says "N-dimensional array".
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC