Skip to content
FoundationSource checked

Axis-Aligned Bounding Box Intersection

Tests whether two axis-aligned boxes overlap on every coordinate axis.

Quick Facts

Compact metadata for implementation and discovery.

Category
Geometry
Difficulty
Beginner
Family
Intersection Test
Tier
Foundation
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
6
Code example
Ready
Visualization
Ready

Overview

Axis-aligned bounding box intersection compares interval overlap independently on each axis. Two boxes intersect only if their projections overlap on all axes.

Core Concepts

axis projectioninterval overlapbroad phaseboundary convention

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(dimensions)

Average

O(dimensions)

Worst

O(dimensions)

Space

O(1)

When to Use

  • Use it for fast broad-phase collision checks.
  • Use it for rectangle, box, viewport, and spatial-index overlap tests.
  • Use it before more expensive exact geometry tests.

When Not to Use

  • Avoid it for rotated boxes unless they have first been converted to an axis-aligned bound.
  • Avoid it when contact at a boundary should be treated differently from overlap without defining the convention.
  • Avoid it as a precise shape-intersection test for complex geometry.

What It Does

  • Tests whether two boxes aligned to coordinate axes overlap
  • Uses axis projection and interval overlap to guide the work.
  • Produces geometric relation, simplified shape, or constructed geometry.

Use Cases

  • Collision and intersection tests
  • Shape analysis
  • Geometry processing

Inputs

  • Points, segments, polygons, or meshes
  • Query shape or tolerance

Outputs

  • Geometric relation, simplified shape, or constructed geometry

Key Formulas (1)

AABB overlap

amin x ≤ bmax x and bmin x ≤ amax x for every axis
a_min_x <= b_max_x and b_min_x <= a_max_x for every axis

Requires interval overlap on all axes.

Pseudocode

  1. 1.Prepare the inputs and state needed for Axis-Aligned Bounding Box Intersection.
  2. 2.Apply the axis projection step while the stopping condition has not been met.
  3. 3.Update intermediate state and discard invalid candidates.
  4. 4.Return geometric relation, simplified shape, or constructed geometry.

Canonical Example

Input
box A = [0,0]-[2,2], box B = [1,1]-[3,3]
Output
intersects = true
Explanation
The x-intervals overlap and the y-intervals overlap.

Implementation Notes

  • Normalize each box so min coordinates are less than or equal to max coordinates.
  • Test overlap per axis and combine the results with AND.
  • Decide whether touching edges count as intersection.

Common Pitfalls

  • Mixing inclusive and exclusive boundary conventions.
  • Letting min and max coordinates become inverted.
  • Using AABBs as exact collision shapes when they are only broad bounds.

Interactive Mechanism Walkthrough

Spatial Primitive & Sweep-Line Canvas

Draw the input shapes, active tests, and generated geometric result.

Axis-Aligned Bounding Box Intersection mechanism walkthrough step 1 of 4
Step 1 of 4: Prepare the inputs and state needed for Axis-Aligned Bounding Box Intersection.
geometry-mechanism

Notes

AABB tests are cheap filters; narrow-phase geometry may still be required.

Sources (1)

What each reference supports for this entry.

Real-Time Collision Detection

Book

Collision detection reference for the geometric or broad-phase/narrow-phase behavior of Axis-Aligned Bounding Box Intersection.

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Broad-phase collision detection commonly uses AABB overlap tests.

AABB tests are cheaper but less tightly fit rotated objects.

Tags

Computational GeometryBounding VolumeCollision DetectionGeometry