Difference between revisions of "Pseudo Mutli-Dimensional Array (3D)"

From Second Life Wiki
Jump to navigation Jump to search
Line 2: Line 2:
<p>
<p>
A list is defined as “a heterogeneous list of the other data types”.  It is linear by nature and can be thought of as a single column.  At the physical level, arrays are stored in contiguous sections of memory. (Another linear structure)  An algorithm is used to translate between the logical rows and columns and the physical level of addresses.
A list is defined as “a heterogeneous list of the other data types”.  It is linear by nature and can be thought of as a single column.  At the physical level, arrays are stored in contiguous sections of memory. (Another linear structure)  An algorithm is used to translate between the logical rows and columns and the physical level of addresses.
</p>
</p><p></p>
<p>
<p>
Consider a list with 48 elements.  Normally we visualize this as a vertical column.  In this case, it is convenient to think of them as 2 tables of 4 rows and 6 columns.  Notice we are starting with element 1.  Element zero is reserved for metadata about the size of the array.
Consider a list with 48 elements.  Normally we visualize this as a vertical column.  In this case, it is convenient to think of them as 2 tables of 4 rows and 6 columns.  Notice we are starting with element 1.  Element zero is reserved for metadata about the size of the array.

Revision as of 16:40, 21 August 2009

In my previous article Pseudo Multi-Dimensional Array, I discussed how to acheive 2 dimensional array behavior in LSL. In this article, we will look at doing the same for a 3 dimensional array.

A list is defined as “a heterogeneous list of the other data types”. It is linear by nature and can be thought of as a single column. At the physical level, arrays are stored in contiguous sections of memory. (Another linear structure) An algorithm is used to translate between the logical rows and columns and the physical level of addresses.

Consider a list with 48 elements. Normally we visualize this as a vertical column. In this case, it is convenient to think of them as 2 tables of 4 rows and 6 columns. Notice we are starting with element 1. Element zero is reserved for metadata about the size of the array.

Layer 0

 012345
0 1 2 3 4 5 6
1 7 8 9101112
2131415161718
3192021222324

Layer 1

 012345
0252627282930
1313233343536
2373839404142
3434445464748


Figure 1. Indexes of a list arranged in rows and columns.