Position elements without overlap
        Posted  
        
            by eWolf
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by eWolf
        
        
        
        Published on 2010-06-17T19:38:40Z
        Indexed on 
            2010/06/17
            19:43 UTC
        
        
        Read the original article
        Hit count: 317
        
I have a number of rectangular elements that I want to position in a 2D space. I calculate an ideal position for each element. Now my problem is that many elements overlap as very often the ideal positions are concentrated in one region. I want to avoid overlap as much as possible (doesn't have to be perfect, though). How can I do this?
I've heard physics simulations are suitable for this - is that correct? And can anyone provide an example/tutorial?
By the way: I'm using XNA, if you know any .NET library that does exactly this job - tell me!
© Stack Overflow or respective owner