liorean
03-11-2005, 05:48 PM
I'm trying to design a data type that is essentially a frame in n dimensions, where you can look up an entry in any given axis and be given a result that is an n-1 dimension frame of the same type, so that the relative cost of looking up in the different axes is not dramatically increased the more dimensions it has and the higher the number of the axis asked for.
Pseudocode e.g:frame threedimframe=new frame(3,4,5);
// Creates a frame with 3 cells in the first axis, four in the second,
// five in the third.
frame planeoffirstaxis=threedimframe.axis(0).cell(1);
// Returns a frame with 4 cells in the first axis, 5 in the second,
// corresponding to the plane of the second cell of the first axis
// of threedimframe
frame planeofsecondaxis=threedimframe.axis(1).cell(3);
// Returns a frame with 3 cells in the first axis, 5 in the second,
// corresponding to the plane of the fourth cell of the second axis
// of threedimframe
frame planeofthirdaxis=threedimframe.axis(2).cell(0);
// Returns a frame with 3 cells in the first axis, 4 in the second,
// corresponding to the plane of the fourth cell of the second axis
// of threedimframeThis in such a way that getting planeofthirdaxis doesn't require much more computation than getting planeoffirstaxis.
Anyone have an idea?
Pseudocode e.g:frame threedimframe=new frame(3,4,5);
// Creates a frame with 3 cells in the first axis, four in the second,
// five in the third.
frame planeoffirstaxis=threedimframe.axis(0).cell(1);
// Returns a frame with 4 cells in the first axis, 5 in the second,
// corresponding to the plane of the second cell of the first axis
// of threedimframe
frame planeofsecondaxis=threedimframe.axis(1).cell(3);
// Returns a frame with 3 cells in the first axis, 5 in the second,
// corresponding to the plane of the fourth cell of the second axis
// of threedimframe
frame planeofthirdaxis=threedimframe.axis(2).cell(0);
// Returns a frame with 3 cells in the first axis, 4 in the second,
// corresponding to the plane of the fourth cell of the second axis
// of threedimframeThis in such a way that getting planeofthirdaxis doesn't require much more computation than getting planeoffirstaxis.
Anyone have an idea?