<p>Funnily enough, I asked this exact question on Math.SE a couple years ago: <a href="https://math.stackexchange.com/questions/859454/maximum-number-of-vertices-in-intersection-of-triangle-with-box/">Maximum number of vertices in intersection of triangle with box</a>.</p>

<p>The answer is 9 vertices, because each of the 6 planes of the box can cut off one corner of the polygon, replacing one vertex with two. So 3 vertices + 6 added vertices due to clipping = 9 total.</p>

CC BY-SA 3.0
2016-03-22T19:22:55.100Z
2016-03-22T19:22:55.100Z
2017-04-13T12:19:38.027Z
Nathan Reed
<p>I clip a 3D triangle against a 3D Axis-Aligned Bounding Box (AABB) to obtain the largest planar polygon of the triangle contained in the AABB. My clipping algorithm is a (slightly modified) version of the robust (e.g. clipping planes have a small finite thickness) Sutherland-Hodgman algorithm as described in C. Ericson's Real-Time Collision Detection. I clip the triangle against each of the 6 planes constituting the AABB.</p>

<p>In order to avoid heap (de)allocation, I allocated a fixed size point buffer on the stack in advance for all the vertices of the obtained planar polygon. My question now is: what is the maximum number of vertices possible one can obtain after clipping a triangle against an AABB? </p>

<p>Based on the control flow, every examined vertex can result in two vertices during a polygon plane clipping. Thus $3*2^6$ vertices. Due to symmetry this becomes $3*2^3=24$ vertices. However, I always obtain less vertices in practice.</p>

<3d><geometry><clipping>
Maximum number of vertices after clipping a triangle against an AABB
Matthias
# Maximum number of vertices after clipping a triangle against an AABB

(Asked by: username_0 on 2016-03-22)

I clip a 3D triangle against a 3D Axis-Aligned Bounding Box (AABB) to obtain the largest planar polygon of the triangle contained in the AABB. My clipping algorithm is a (slightly modified) version of the robust (e.g. clipping planes have a small finite thickness) Sutherland-Hodgman algorithm as described in C. Ericson's Real-Time Collision Detection. I clip the triangle against each of the 6 planes constituting the AABB.

In order to avoid heap (de)allocation, I allocated a fixed size point buffer on the stack in advance for all the vertices of the obtained planar polygon. My question now is: what is the maximum number of vertices possible one can obtain after clipping a triangle against an AABB?

Based on the control flow, every examined vertex can result in two vertices during a polygon plane clipping. Thus $3\*2^6$ vertices. Due to symmetry this becomes $3\*2^3=24$ vertices. However, I always obtain less vertices in practice.

**Tags:** 3d, geometry, clipping


---

## 1 answers

### Answer by username_1 on 2016-03-22. Score: 9 | Accepted answer

Funnily enough, I asked this exact question on Math.SE a couple years ago: [Maximum number of vertices in intersection of triangle with box](https://math.stackexchange.com/questions/859454/maximum-number-of-vertices-in-intersection-of-triangle-with-box/).

The answer is 9 vertices, because each of the 6 planes of the box can cut off one corner of the polygon, replacing one vertex with two. So 3 vertices + 6 added vertices due to clipping = 9 total.


---

