Filling in leftover space

edited February 2013 in Freetile
In reading over the calculatePositions function, it seems like it wouldn't be too difficult to keep track of spaces left behind when a column is cut off (with space remaining) by an element too wide to fit into it. If we could keep track of those positions (perhaps in a separate array?) we could have an option to "fill in empty space" later on, when we come across tiles small enough to fit. See this example:

http://joemarty.mediacoop.org/dev/sandbox/freetile/

If we wanted to go the extra mile, perhaps we could also provide an option like "maxUnsortDistance" to provide some way to limit the distance a tile can be moved from where it would otherwise have appeared, to fill in empty space (which can be adjusted to account for how important sorting order is to the particular application).

Is this something you've looked into before? It doesn't seem terribly difficult, but would be extremely useful! I haven't seen any library that does this so far (I've been looking for one).

Comments

  • edited November -1
    Hi mitsy,

    Yes, you are right, it is possible, even with the same array if there is dimension information for the positions. In fact, this is bringing us closer to the heuristics actually used by 2-d bin packing algorithms, the ones applied in container packing, sheet cutting etc.

    The unsortdistance is a great idea as well. It could be indeed a good direction in resolving the sorting issue.

    I would like very much to investigate this possibility, however right now I am extremely short on time, so I'm keeping it as a great idea for the near future. Of course, if you manage to make any steps towards this direction I would be very excited to find about.

    Thank you once again.
    Yannis
Sign In or Register to comment.