AABB Visualizer

Interactive 3D visualization tool for Axis-Aligned Bounding Box (AABB) construction and collision detection

Loading 3D Visualizer...

Geometry

Transform

Position

0.00
0.00
0.00

Rotation

0.00
0.00
0.00

Scale

1.00
1.00
1.00

Display Options

Collision Test Area

Position

2.00
0.00
0.00

Size

1.00
1.00
1.00

Collision Status

Not Colliding

Code Generator

// AABB 计算
function computeAABB(vertices, transform) {
  const min = { x: Infinity, y: Infinity, z: Infinity };
  const max = { x: -Infinity, y: -Infinity, z: -Infinity };

  for (const vertex of vertices) {
    const transformed = applyTransform(vertex, transform);
    min.x = Math.min(min.x, transformed.x);
    min.y = Math.min(min.y, transformed.y);
    min.z = Math.min(min.z, transformed.z);
    max.x = Math.max(max.x, transformed.x);
    max.y = Math.max(max.y, transformed.y);
    max.z = Math.max(max.z, transformed.z);
  }

  return { min, max };
}

// AABB 碰撞检测
function testAABBCollision(aabb1, aabb2) {
  return (
    aabb1.min.x <= aabb2.max.x && aabb1.max.x >= aabb2.min.x &&
    aabb1.min.y <= aabb2.max.y && aabb1.max.y >= aabb2.min.y &&
    aabb1.min.z <= aabb2.max.z && aabb1.max.z >= aabb2.min.z
  );
}

Features

Real-time AABB calculation
Interactive collision detection
6 different geometry types
Code generation (JS/TS/GLSL/C++)
Adjustable transform parameters
Animation system

About AABB Visualizer

Axis-Aligned Bounding Box (AABB) is a fundamental concept in 3D graphics and game development. It's the simplest form of bounding volume, defined by minimum and maximum points along each axis, making collision detection extremely fast.

This interactive tool helps you understand how AABBs are constructed from 3D geometry and how they respond to transformations. You can experiment with different shapes, adjust their position/rotation/scale, and see the AABB update in real-time.

The collision test area demonstrates AABB-AABB intersection testing, a core technique used in game engines for broad-phase collision detection, spatial partitioning (octrees), and frustum culling.

Use Cases

1

Game Development

Implement efficient collision detection systems using AABB as the first-pass broad-phase test

2

Physics Engines

Use AABB trees for spatial partitioning and dynamic object management

3

Frustum Culling

Optimize rendering by testing if object AABBs are within the camera frustum

4

Ray Casting

Accelerate ray-object intersection tests using AABB as preliminary check

Algorithm Explanation

AABB Construction

To construct an AABB, iterate through all vertices of the geometry, apply the transformation matrix (position, rotation, scale), then compute the minimum and maximum points along each axis.

Collision Detection

Two AABBs collide if they overlap on all three axes. For each axis, check if AABB1.min <= AABB2.max AND AABB1.max >= AABB2.min.

Time Complexity

Construction: O(n) where n is the number of vertices. Collision test: O(1) constant time.

AABB Visualizer - 3D Bounding Box & Collision Detection Tool | BeSmile | BetterTools