What's the algorithm to divide a rectangle (c struct
with 4 int
s) to a random number of smaller rectangles (return a list of struct
s)? Even better if the max and min dimension of the smaller rectangles can be controlled by a parameter.
e.g.
+----------+ +-------+--+
| | | | |
| | | | |
| | --> |---+---+--| (good)
| | | | |
| | +---+ |
| | | | |
+----------+ +---+------+
smaller shapes should be 4-sided, the following is not good:
+----------+ +-------+--+
| | | | |
| | | | |
| | --> |---+---+--| (not good)
| | | |
| | +---+ |
| | | | |
+----------+ +---+------+
Thanks!
Appendix: (rectangle for Moron's discussion)
+----+--------+
| | |
| +---+----+
| | | | (rectangle-chase)
+----+---+ |
| | |
+--------+----+