Axis-Aligned vs. Rotated Rectangles: Choosing the Right Representation for Collision Detection
When simple bounding boxes fail, you need to distinguish between axis-aligned and arbitrarily rotated rectangles. AABB checks are fast, but rotated objects require more robust methods like the Separating Axis Theorem (SAT).
20 Oct 2026, 00:06 UTC

When simple bounding boxes fail, you need to distinguish between axis-aligned and arbitrarily rotated rectangles.
The useful takeaway is that for most common 2D game or spatial indexing tasks, assuming axis-alignment (AABB) is faster; however, if rotation is necessary, using corner coordinates for intersection testing is mandatory over simple width/height checks.
Defining the Rect
In a standard Cartesian coordinate system, a rectangle (Rect) is fundamentally defined by its width and height, or by two opposing corner coordinates. If the rectangle is axis-aligned (AABB), its sides are parallel to the X and Y axes. If it is rotated, its orientation must be tracked, usually via an angle or four specific corner points.
Intersection Testing Trade-offs
Checking if two AABBs overlap is extremely fast—it only requires checking for overlap on the X-axis AND overlap on the Y-axis. This is a simple comparison of min/max coordinates. Intersection testing between two arbitrarily rotated rectangles requires more complex algorithms, such as the Separating Axis Theorem (SAT).
Worked Example: AABB Intersection
Consider two AABBs. Rectangle A spans (x1, y1) to (x2, y2), and Rectangle B spans (x3, y3) to (x4, y4). They intersect if and only if:
- (x1 < x4) AND (x2 > x3)
- AND
- (y1 < y4) AND (y2 > y3)
For instance, if Rect A is defined by (0, 0) to (10, 10) and Rect B is defined by (5, 5) to (15, 15), the conditions hold, and they intersect.
Limitation: Computational Cost
The primary limitation of using the AABB simplification is that it can lead to false positives. If a thin, rotated object is entirely outside another object but its bounding box overlaps, the AABB test incorrectly reports an intersection. SAT correctly handles this but is computationally heavier.
Actionable Decision
If your application only requires broad-phase collision checks (e.g., filtering potential pairs before detailed checks), use AABBs. If precise collision detection for rotated objects is required, use the corner coordinate representation and implement SAT.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.