Jesse mentionned TreeMap, which also uses a packing algorithm for laying out 
squares of varying size.

Here is an open source implementation written in Flex:

https://github.com/joshtynjala/flextreemap

So the algorithm may not fit your needs, because packing squares and packing 
rectangles is not the same, but you could surely find inspiration.

Maurice 

-----Message d'origine-----
De : Alex Harui [mailto:aha...@adobe.com] 
Envoyé : samedi 23 novembre 2013 01:01
À : users@flex.apache.org
Objet : Re: Sprite Auto Alignment

Sometimes, an additional constraint or two can make the problem much easier to 
solve.

I thought you could run C# code in the browser wrapper and not involve the 
server.

-Alex

On 11/22/13 11:54 AM, "Jake Churchill" <reyna...@gmail.com> wrote:

>Alex,
>
>Yes, there are constraints but they are dynamically generated.  The app 
>is a web app but I'm trying really hard not to involve the server for this.
>
>Thanks!
>
>-Jake
>
>
>On Fri, Nov 22, 2013 at 1:19 PM, Alex Harui <aha...@adobe.com> wrote:
>
>> It isn't clear that the "fast" algorithm will always return the best 
>> possible result. You may have to make some trade-offs of algorithm 
>> complexity, compute time, and quality of the results.
>>
>> Are there other constraints on the problem-space that might make it 
>>easier?
>>
>> Is this a web app?  If so, you might be able to run the C# code via 
>> ExternalInterface.
>>
>> -Alex
>>
>> On 11/22/13 11:06 AM, "Jake Churchill" <reyna...@gmail.com> wrote:
>>
>> >The problem with a treemap is it fills up the entire space.  I need 
>> >it
>>to
>> >not do that.  The problem with the codeproject that Lee mentioned is
>>it's
>> >all C# and while I'm sure I can re-write it to AS3, I'd prefer not 
>> >to
>>have
>> >to.
>> >
>> >-Jake
>> >
>> >
>> >On Fri, Nov 22, 2013 at 11:55 AM, Jesse Ward-Karet <j...@tanium.com>
>> wrote:
>> >
>> >> Consider treemap algorithms. There are a couple links to academic
>>papers
>> >> on the subject and a cool real world implementation here:
>> >>
>> >> http://windirstat.info/background.html
>> >>
>> >>
>> >> > On Nov 22, 2013, at 9:40 AM, Lee Burrows
>> >><subscripti...@leeburrows.com>
>> >> wrote:
>> >> >
>> >> > isnt google amazing!
>> >> >
>> >> >
>> >>
>> >>
>> 
>>http://www.codeproject.com/Articles/210979/Fast-optimizing-rectangle-p
>>ack
>> >>ing-algorithm-for-bu
>> >> >
>> >> >> On 22/11/2013 17:35, Jake Churchill wrote:
>> >> >> Guys,
>> >> >>
>> >> >> I'm working on a project with a component that displays child
>>sprites
>> >> of different sites and allows the user to arrange them.  The 
>> >> sprites
>>are
>> >> all rectangles of different sizes.
>> >> >>
>> >> >> What I'm trying to do is create an auto-align which will crunch
>>the
>> >> children down into the smallest possible arrangement.
>> >> >>
>> >> >> I'm wondering if anyone has heard of or has some kind of logic
>>that
>> >> would help with this.  FYI, I'm not looking for a handout.  I've
>>already
>> >> gone through 2 different iterations of the logic and each has a 
>> >>bug once in  a while.
>> >> >>
>> >> >> Where I run into issues is when I have one really tall sprite 
>> >> >> and
>>a
>> >> bunch of shorter ones.  I get things aligned in a single row and 
>> >> then create another row on top and start lining up the additional 
>> >> ones,
>>but
>> >> really what should happen is I should have the larger sprite have 
>> >> a "rowspan" like you can with html tables.
>> >> >>
>> >> >> I've attached an illustration from the app.  The top 2 images 
>> >> >> is
>> >>start
>> >> and after the auto align.  This works well when the sprites are 
>> >>about the  same size.  The 2nd row is what happens with a taller 
>> >>sprite and much  smaller sprites, and finally below is what I would 
>> >>like to have
>>happen
>> >>but
>> >> am having issues getting there.
>> >> >>
>> >> >> Any help would be awesome.
>> >> >>
>> >> >> Thanks!
>> >> >>
>> >> >> -Jake
>> >> >
>> >> >
>> >> > --
>> >> > Lee Burrows
>> >> > ActionScripter
>> >> >
>> >>
>>
>>

Reply via email to