I asked this as a
question in Programs and dropped it but was inspired by
"Imagining the Tenth Dimension" to pick it up again. For those of you used to three dimensions or less, the flash movie is a really good beginners guide to 10 dimensions (seriously).
Anyhoo. My question was about taking a length of string (an array) and turning a point on that string into a point in a number of dimensions.
We do this by folding and splitting our piece of string. Moving into the higher dimensions we stack, split and fold time, reality, infinity, etc. When we get a single pixel from the pixels[] array we perform a fold and a split. By stacking the folds and the size of the split we can turn a single dimension into many:
Code:
int [] dim = {
10, 10, 10};
void setup(){
int [] foldy = getFolded(131, dim);
print(foldy);
println();
print(getUnfolded(foldy, dim));
}
int [] getFolded(int n, int [] d){
int [] coord = new int[d.length];
for(int i = 0; i < d.length; i++){
coord[i] = n;
//folding
for(int j = d.length - 1; j > i; j--){
int level = 1;
for(int k = 0; k < j; k++){
level *= d[k];
}
coord[i] %= level;
}
//splitting
int level = 1;
for(int j = 0; j < i; j++){
level *= d[j];
}
coord[i] /= level;
}
return coord;
}
int getUnfolded(int [] p, int [] d){
int coord = 0;
//stacking
for(int i = 0; i < p.length; i++){
int level = 1;
for(int j = 0; j < i; j++){
level *= d[j];
}
coord += p[i] * level;
}
return coord;
}
You need never use massively multi-dimensional arrays again.
Another tack would be to feed in a point in arbitrary dimensions and get it's locus in arbitrary dimensions. A low key route would be to unfold into one dimension and then fold back into the required amount of dimensions.
In writing that statement I've just figured out the algorithm, but I'll post that later.
If anyone has a clue on how to make this work on Floats that would be great news. Particles I imagine could be modelled moving through hyperspace, interacting with forces in higher dimensions.