IT lexicon › Programming › Spatial partitioning

Spatial partitioning

Programming På svenska → Updated: 2026-10-24

Dividing space into regions so a query examines only nearby objects instead of all of them.

Testing every object against every other is O(n²) — fine for ten objects, ruinous for ten thousand. Spatial partitioning indexes objects by where they sit, so a collision or visibility query touches only the cells near the point you are asking about.

The structures differ in how they cut space: a uniform grid splits it into equal cells, a quadtree or octree subdivides recursively where objects cluster, a BSP tree cuts along arbitrary planes. All trade memory and update cost for far cheaper queries, and all sit behind the broad phase of collision detection and view-frustum culling.

← Back to the lexicon