Fast Triangle clipping?

Hi,

does anybody know of a fast way to clip a triangle to an axis-aligned bounding box? I actually don´t even need the correct resulting polygon but simply the axis aligned bounding box of the clipped triangle.

My current approach doesn´t seem to be really fast since it involves testing a ray agains all planes of the AABB for each triangle edge and doing a lot of if - else constructs

Any ideas?

Case

Case

If you really only need the bounding box of the clipped triangle, you can just clip the triangles bounding box in the first place.

Compute the triangles AABB as usual by computing the min and max values for x, y, and z. Then clip those values to the range given by the outer bounding box.

Hi,

sadly this won´t be enough for my case. I need the clipping for building a good kdtree. If I just clip the bounding box, the resulting clipped bounding box will still be too large in many cases resulting in many more triangles.

Thanks anyway

Case