Quantcast
Channel: Latest Questions by Griffo
Viewing all articles
Browse latest Browse all 94

Array or List holding 3 floats, multidimensional, Jagged?

$
0
0
Hi, As below I have 3 arrays holding floats, 7, 7 and 4 .. What I'd like to do is make a list or array (as I know lists are faster) with all these values in one list or array, so I could call 1,1 .. 1,2 .. 1,3 when I want the 1st values and 2,1 .. 2,2 .. 2,3 when I want the 2nd values .. ect .. ect So would this be a multidimensional array, jagged or ? What would be the best way to do this? Would I use something like .. var aGrid : float[,]; function Start () { aGrid = new float[ 7, 3 ]; // Init aGrid // ---------------------- aGrid[ 0, 0 ] = 5; aGrid[ 0, 1 ] = 2.5; aGrid[ 0, 2 ] = 1.4; // ---------------------- aGrid[ 1, 0 ] = 4; aGrid[ 1, 1 ] = 2; aGrid[ 1, 2 ] = 1.2; // ---------------------- aGrid[ 2, 0 ] = 3; aGrid[ 2, 1 ] = 1.5; aGrid[ 2, 2 ] = 0.8; // ---------------------- aGrid[ 3, 0 ] = 2; aGrid[ 3, 1 ] = 1; aGrid[ 3, 2 ] = 0.4; // ---------------------- aGrid[ 4, 0 ] = 2; aGrid[ 4, 1 ] = 2; aGrid[ 4, 2 ] = 0; // ---------------------- aGrid[ 5, 0 ] = 1.6; aGrid[ 5, 1 ] = 1.6; aGrid[ 5, 2 ] = 0; // ---------------------- aGrid[ 6, 0 ] = 1.08; aGrid[ 6, 1 ] = 1.08; aGrid[ 6, 2 ] = 0; // ---------------------- } Or have I missed it completely ? Should I put all those numbers in a string then populate the array in a loop? thanks .. ![alt text][1] [1]: /storage/temp/27002-screen+shot_01.jpg

Viewing all articles
Browse latest Browse all 94

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>