More Dimensions in arrays
#1

Currently I'm doing it this way:
Код:
#define FIRST_DIMENSION 3
#define SECOND_DIMENSION 16
#define THIRD_DIMENSION 24

// GetFirstDim(firstDim, secondDim, secondDimSize);
#define GetFirstDim(%0,%1,%2) ((%1 < %2)?((%0*%2)+%1):((%0*%2)+%2-1))

enum bPathInf
{
	sampleInt,
	Float: sampleFloat
};
new SampleArray[FIRST_DIMENSION*SECOND_DIMENSION][THIRD_DIMENSION][bPathInf];

// Somewhere in my code I get a value like that:
SampleArray[GetFirstDim(0, 1, SECOND_DIMENSION)][0][sampleInt] = 0;
So I have a question, is my way any good, or would using two separate arrays to store 4 dimensions be a better solution. Or is there an even better one available?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)