BytePtr
November 8th, 2009, 08:32 PM
I have a simple 3D fixed size array: [256][256][8].
Let's say that basically array contains 256x256 stacks (columns) of cubes: 0..7.
So maximum there are 8 cubes can be placed on each other. No more. There can be total of 131072 stacks or columns.
Just something like on this image
http://www.smartscience.net/SmartScience/MindGames/images/cube.gif
Every cube has it's own random number assigned. And every stack (column) has
random number of cubes. Some can have 1 cube, some 4 some 8 etc.
So many columns and cubes may have repeated over.
What i need?
Basically i need to get ride of repeatness.
I need to get only cubes with unique numbers and i need only unique columns.
So if i find for example many similar cubes or columns i have to add them together.
So they become unique together.
How would i search array for repeats and get only unique stuff out of array?
What algorithm can be used?
Do i have to sort array first?
If something is unclear about what i need then notify me, i will try re-explain.
Basically im implementing some compression.
Let's say that basically array contains 256x256 stacks (columns) of cubes: 0..7.
So maximum there are 8 cubes can be placed on each other. No more. There can be total of 131072 stacks or columns.
Just something like on this image
http://www.smartscience.net/SmartScience/MindGames/images/cube.gif
Every cube has it's own random number assigned. And every stack (column) has
random number of cubes. Some can have 1 cube, some 4 some 8 etc.
So many columns and cubes may have repeated over.
What i need?
Basically i need to get ride of repeatness.
I need to get only cubes with unique numbers and i need only unique columns.
So if i find for example many similar cubes or columns i have to add them together.
So they become unique together.
How would i search array for repeats and get only unique stuff out of array?
What algorithm can be used?
Do i have to sort array first?
If something is unclear about what i need then notify me, i will try re-explain.
Basically im implementing some compression.