5
$\begingroup$

For an art project I want to compute a division of space into random squares. I have a number of applications where this would be a pleasant visual layout, I'm trying to figure this out for myself, but I think it might be useful to others too.

Given a 2D space of x width and y height. How do I divide it into squares of varying sizes (factors of the largest possible square for a particular area, some areas will have smaller maximum sized squares due to the initial division of space.)

I will add a diagram later today to illustrate better / more specifically what I am attempting to do.

Thank you.

Edit: I'll want to add a limit for the smaller sizes, as these will be used to display content at a fixed resolution.

  • 0
    @lhf - note that my answer was the one I was looking for when I originally posted this question in January.2012-05-21

1 Answers 1

2

Turns out what I want is Squaring the Square, as suggested by @StevenStadnicki, the best resource for this is http://squaring.net

There's a ton of information there surrounding the history of squared-squares and rectangles, the first perfectly squared square, that is a square divided by smaller squares all of unique sizes, was successfully calculated in 1939.

In a similar manner to log tables, squared-squares, and squared-rectangles have been catalogued too, these are listed in a notation called Bouwkamp codes or Tablecodes (they both essentially contain the same information, Bouwkamp codes provide parentheses and commas to make them slightly more human readable.)

For example, you can describe a 4x4 imperfect squared square, with all the interior squares the same size, e.g. a 100 unit square, filled with 25 unit squares like this:

Table code...: 16 100 100 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25  Bouwkamp code: 16 100 100 (25,25,25,25) (25,25,25,25) (25,25,25,25) (25,25,25,25)  

As you can see, simply stripping the punctuation from a Bouwkamp code gives you an equivalent Table Code.

These code enables you to fill a rectangle, of dimensions described by the 2nd and 3rd indicies, with n squares (as described by the 1st index), the remaining indicies each describe a square within this rectangle/square.

This makes them relatively easy to draw by hand, or using a simple algorithm, as long as you record the current lowest Y axis value, and the width of the gap at that vertical level. The Bouwkamp notation helps when drawing manually, using parentheses to denote the set of squares that fit the next available gap width.

Anyway, for my nefarious uses, they make nice photo framing devices...

http://distilleryimage3.s3.amazonaws.com/e11cd9729bd711e1be6a12313820455d_7.jpg

  • 0
    @GerryMyerson I agree, but it's a fair enough place to come from when ignorant of the possible solutions, and they certainly are of "random" sizes, to the lay-person. I feel that as someone without classical math training (such as myself.) Topics like this are difficult to discover.2012-05-21