com.jpemartin.jgt
Class CollisionDetection
java.lang.Object
com.jpemartin.jgt.CollisionDetection
public class CollisionDetection
- extends java.lang.Object
static methods for detecting collisions
|
Method Summary |
static
<T extends java.awt.Rectangle,U extends java.util.Collection<T>,V extends T,W extends java.util.Collection<V>>
Pair<java.util.List<T>> |
|
findCollisionListSlow(U a,
W b)
given two lists of rectangles, gives a list
of all pairs that intersect. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CollisionDetection
public CollisionDetection()
findCollisionListSlow
public static <T extends java.awt.Rectangle,U extends java.util.Collection<T>,V extends T,W extends java.util.Collection<V>> Pair<java.util.List<T>> findCollisionListSlow(U a,
W b)
- given two lists of rectangles, gives a list
of all pairs that intersect.
This function does not require any of the two lists
to be sorted (but it's a bit slow)
The two lists don't need to be the same type, but
they must both be collections of something that extends Rectangle and
if they differ then the second one should be a subclass of the first one.
We return a pair of lists instead of a list of pairs
to limit the number of objects we create (for performance)
If there's no collision, this may return either a pair of empty lists
or a null pointer.