Why don't you allow empty leaves in your tree? Edit: Maybe I do not understand the question ^^. Your problem is that you get non-square images like 2x1 and want to represent them as quadtreenode?
If you have a 2x2 square, for example
12
3 4
you would create a quadnode with something like "the new quadnode (1,2,3,4)"
I suggest passing a 2x1 square e.g.
12
with something like the βnew QuadNode (1,2, null, null)β When you have the big missing parts, you can use the same system. When you have a 4x2 image like
1 2 3 4
5 6 7 8
you will get "new QuadNode (new QuadNode (1,2,3,4), null, new QuadNode (5,6,7,8), null)"
This should also work with parts with the same color instead of pixels.
I understood your problem and made it clear?
kasten
source share