Subject: Re: Stretch factor compatibility in 2.9 Newsgroups: gmane.comp.lib.wxwidgets.devel Date: Tuesday 13th October 2009 17:47:21 UTC (over 8 years ago) Hi, > Unfortunately I don't have enough time to think about how to > generalize the algorithm I tried to propose to N items but if we could > define it clearly, implementing it shouldn't be too hard... Probably not exactly your algorithm, but how do you like this attempt: - Start with a set of all items with proportion > 0 - while the set changes (or easier to check: the size to be distributed between the items in the set changes) do the following: - Size the items in the set according to proportions. - Increase the size of all items to at least their minimal size, removing those that needed changing from the set and update the size that can be distributed between the items in the set. So, if you have proportions e.g. 1,4,1,1,5 all the items with proportion 1 might need to be increased, but the item with proportion 4 should remain at 80% of the size of the item with proportion 5 (assuming there's enough space). Regards, Stefan |
|||