How to detect two moving shapes overlapped?
        Posted  
        
            by 
                user1389813
            
        on Programmers
        
        See other posts from Programmers
        
            or by user1389813
        
        
        
        Published on 2012-10-27T04:49:04Z
        Indexed on 
            2012/10/27
            5:16 UTC
        
        
        Read the original article
        Hit count: 544
        
Given a list of circles with its coordinates (x and y) that are moving every second in different direction (South-East, South-West, North-East and North-West), and the circle will change direction if it hits the wall sort of like bouncing, so how do we detect if any of them collide or overlap with each other ? I am not sure if we can use some data structures like a Binary Search Tree because since all the coordinates  vary every seconds, so the tree will have to re-build accordingly. Or can we use Vertical Sweep Line Algorithm each time ? Any ideas on how to do this in a efficient way ? 
© Programmers or respective owner