NaiveBroadPhaseCollisionDetector

A naive implementation of a broad-phase collision detection algorithm.

The NaiveBroadPhaseCollisionDetector is a concrete implementation of the BroadPhaseCollisionDetector interface. It identifies pairs of potentially overlapping bodies in a physics simulation by performing an exhaustive comparison of their bounding volumes. This approach provides straightforward and simple collision detection but does not scale efficiently with large numbers of bodies due to its O(n^2) complexity.

The method utilizes the findOverlappingPairs function, which directly checks intersections between bounding rectangles of all input bodies.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open suspend override fun findOverlappingPairs(bodies: List<Body>): List<Pair<Int, Int>>