i think it would be good to define how you would expect it to behave so your algorithm can match that.
do all items have to be visible at the same time? if there are only 5 items, do you want 3 rows and 2 columns, or 2 rows and three columns? maybe 1 row or column? if there are 300 items, are you looking for the most filled out grid? as in, is it bad to have the last row with one item, or would it be better if each row and column were filled the most based off the number of items? "what scale to make them so that they all fit" > are you interested in maintaining aspect ratio of whatever these items are, or would you stretch them? i have never done this before but i feel like you could use modulus to help. maybe something about finding the two numbers closest to each other to determine the number of rows and columns. ie. 5 items = 2*2 r1 so you have a 2*3 grid 100 items = 10*10 so you have a 10*10 grid 300 items = 17*17 r 13 so you have a 17*18 grid not sure how you find out those numbers though/yet. On Wed, Jan 4, 2012 at 2:01 PM, Matt Perkins <[email protected]> wrote: > Need a little nudge/help for a project. > > I've got a set of X number of items (5-300+) than I need to display > in a constrained area (ex: 1000x600). I need to calculate how many > rows, columns and at what scale to make them so that they all fit. > > I'm having a bad mental block and can't get moving on it. Any ideas? > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- Ktu; The information contained in this message may or may not be privileged and/or confidential. If you are NOT the intended recipient, congratulations, you got mail! _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

