Jump to content
  • Advertisement
Sign in to follow this  
MxADD

Finding a minimal number of BBoxes in volume

This topic is 3774 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I have a 3D volume (regular grid, say 128x128x128) in this volume each cell has value 0 (empty) or 1 (occupied). Now I need to find a minimal (sub-optimal solution also will do :)) number of bounding boxes that encapsulates ALL non-empty cells. Is there any algorithm that can do this ? For more clearance below is some ASCII art showing what i want to accomplish in simple 2D case. grid 8x8: <code> 0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ |1|1| | | | | | | 0 +-+-+-+-+-+-+-+-+ |1|1|1|1|1|1|1|1| 1 +-+-+-+-+-+-+-+-+ |1|1| | |1|1|1| | 2 +-+-+-+-+-+-+-+-+ | | | | |1| | | | 3 +-+-+-+-+-+-+-+-+ | | | | |1| | | | 4 +-+-+-+-+-+-+-+-+ | | | | |1|1|1|1| 5 +-+-+-+-+-+-+-+-+ | | | | |1|1|1|1| 6 +-+-+-+-+-+-+-+-+ | | | | | | | |1| 7 +-+-+-+-+-+-+-+-+ </code> the result should be 6 BBoxes: <code> 0 1 2 3 4 5 6 7 +-+-+ |111| 0 +111+-+-+-+-+-+-+ |111|22222222222| 1 +111+-+-+-+-+-+-+ |111| |33333| 2 +-+-+ +-+-+-+ |4| 3 +4+ |4| 4 +-+-+-+-+ |5555555| 5 +5555555+ |5555555| 6 +-+-+-+-+ |6| 7 +-+ </code> 1st box is min: (0, 0), max (2, 3) 2nd box is ... etc. Any ideas how to do this ? Thanks for any ideas.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!