I am writing an application which subdivides an N-dimensional axis aligned bounding box into smaller N-dimensional bounding boxes, I need an algorithm which will do this.
For example:
in 1 dimension a "bounding box" is simply a length
e.g. { Min=0, Max=100 }
which would be subdivided into
{Min=0, Max=50} and {Min=50, Max=100}
in 2 dimensions a "bounding box" is a square
e.g. {Min=[0,0], Max=[100,100]}
would be divided into
{Min=[0,0], Max=[50,50]}
{Min=[0,50], Max=[50,100]}
{Min=[50,0], Max=[100,50]}
{Min=[50,50], Max=[100,100]}
And so on, all I need is a description of an algorithm for doing this, language doesn't particularly matter, since once I know how to do it I can translate it into the language of choice (C# in this case)
EDIT:: In response to questions in comments:
- subdivisions must always be equal (as in the examples)
- boundaries are floating points, so divisibility by two isn't a problem