views:

77

answers:

2

Hi, I need a solution for quite complex problem. Exactly, I need to calculate the number of rectangles that can be placed inside letter/character with given size, considering that all rectangles are the same size, but it(the size) and the letter/character(of some regular specific font) itself can be changed by user(this will be used as webside calculator of signboard price). If describe this graphically, it looks like this:

alt text

Any ideas or useful links will be much appreciated. Thanks in advance

+1  A: 

This is 2D bin-packing. This page might clear it up a bit: http://users.cs.cf.ac.uk/C.L.Mumford/heidi/Background.html

The wiki page on bin-packing: en.wikipedia.org/wiki/Bin_packing_problem has a link to a software package which might come in handy: http://code.google.com/p/caparf/

You are unlucky that this is NP-Hard. You are lucky that this is a widely researched topic and has many approximation algorithms. Most current literature on bin-packing should have some information which should help.

Moron
Thanks. But the next problem is that I cannot figure out how to calculate the area of the character or its line length.
Nickolay
@Nickolay: You probably should create a new question for that.
Moron
+1  A: 

About size of characters:

Print char in bitmap and count black regons

ralu