Results 1 to 6 of 6

Thread: fill area with cubes

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    This is the logic that I would use for such problem. It probably isn't the fastest one but it should finish the job.

    1. I would divide the 3D space you have into a grid whose density would be suitable so that every existing box fits into the grid perfectly.
    2. I would give every existing box a unique ID and then assign that ID to the gird cells that are being occupied by that box. This would give me information about which grid cells are occupied and which not.
    3. I would try to find first empty grid cell and place a new box in it (just 1,1,1 box for now). It is preferable if this starting cell is in a corner. And don't forget to give it a unique ID
    4. Then I would start expanding the size of this box while maintaining its aspect ratio (2,2,2 then 3,3,3, then 4,4,4 etc.) until the size can no longer be expanded.
    //Only used for rectangular cuboids
    5. After that if you don't need for the boxes to have all sizes equal you can try and start extruding (expanding) a single face of this new box.
    6. Later you can try extruding some other face of the box. If your initial box was placed in corner you would have to do this only for two box faces max.
    7. After you fully expanded your first box you find the next free grid cell and repeat the process from 3. step
    8. Finally you simply get dimensions of your new boxes with the help of having unique ID's stored in grid cells

    This approach should fill all the spaces and also try to use as biggest boxes as possible to do so.
    Last edited by SilverWarior; 03-04-2016 at 02:05 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •