This is great stuff! Thanks guys, I've been going round in circles with this for quite a while.
M > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf > Of Danny Kodicek > Sent: 09 May 2006 08:54 > To: Flashcoders mailing list > Subject: Re: [Flashcoders] Fitting squares into an area > > >For N = 100, the number of iteration depends on the ratio: > it could be > anywhere from 19 (10x10-1) to 100 iterations (worst case > happens if the output is a single line or a single column). > So that would make N iterations (in worst cases) and > ~2*SQRT(N)-1 best case. > > It occurs to me that these cases could be cleared up with a > fairly small revision to the algorithm: when calculating > initial values of rows and cols, take into account the ratio: > (using your code) > > if (width<height) { > var cols:Number = 1; > var rows:Number = Math.floor(height/width) } else { > var rows:Number = 1; > var cols:Number = Math.floor(width/height) } > > Danny > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com http://training.figleaf.com > _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com