Check if there's any other object between obj1 and obj2.
(obj1, obj2)
| 570 | y1 = max(obj1.y1,obj2.y1) |
| 571 | return ((x1-x0)*(y1-y0) - obj1.width*obj1.height - obj2.width*obj2.height) |
| 572 | def isany(obj1, obj2): |
| 573 | """Check if there's any other object between obj1 and obj2. |
| 574 | """ |
| 575 | x0 = min(obj1.x0,obj2.x0) |
| 576 | y0 = min(obj1.y0,obj2.y0) |
| 577 | x1 = max(obj1.x1,obj2.x1) |
| 578 | y1 = max(obj1.y1,obj2.y1) |
| 579 | objs = set(plane.find((x0,y0,x1,y1))) |
| 580 | return objs.difference((obj1,obj2)) |
| 581 | # XXX this still takes O(n^2) :( |
| 582 | dists = [] |
| 583 | for i in xrange(len(boxes)): |