Skip to content

Instantly share code, notes, and snippets.

@mtsamis
mtsamis / SIMD_AABB.md
Created November 21, 2023 16:37
An optimized representation for 2D AABBs and SIMD intrinsics

(Note: This writeup assumes some knowledge of SIMD programming, assembly and AABBs).

Introduction

There are a couple of ways to represent an axis aligned bounding box in 2D, but I think the most common is to store the minimum and maximum coordinates. With this approach, most basic operations (overlap tests, union/intersection, etc.) have simple implementations and offer decent performance.

Some time ago, I came up with a modification to this AABB representation that has the potential for better performance. I haven't seen this technique mentioned or used anywhere, but if you have seen it somehow I would appreciate it if you could let me know.