Module org.dyn4j

Class LazyAABBTree<T extends CollisionBody<E>,​E extends Fixture>

  • Type Parameters:
    T - the CollisionBody type
    E - the Fixture type
    All Implemented Interfaces:
    BatchBroadphaseDetector<T,​E>, BroadphaseDetector<T,​E>, Shiftable

    public final class LazyAABBTree<T extends CollisionBody<E>,​E extends Fixture>
    extends AbstractBroadphaseDetector<T,​E>
    implements BatchBroadphaseDetector<T,​E>
    Deprecated in 4.0.0. Use a different BroadphaseDetector instead.
    Implementation of a self-balancing axis-aligned bounding box tree broad-phase collision detection algorithm.

    This class implements a aabb tree broad-phase detector that is based on ideas from DynamicAABBTree but with some very critical improvements. This data structure is lazy in the sense that it will build the actual tree as late as possible (hence the name). Performance is optimized for fast detection of collisions, as required by the World class. Raycasting and other functionalities should see no big improvements. Insertion is O(1), update is O(logn) but batch update (update of all bodies) is O(n), remove is O(logn) average but O(n) worse.

    The class will rebuild the whole tree at each detection and will detect the collisions at the same time in an efficient manner.

    This structure keeps the bodies sorted by the radius of their fixtures and rebuilds the tree each time in order to construct better trees.

    Manolis Tsamis