Skip navigation

To reach our weekly goal, we need to made an algorithm which detects collision between a triangle and a cube.

At the first sight, it’s looks pretty easy, we just have to test if any vertex of the triangle is inside the cube. However there could be a case where there is no vertex of the triangle inside the cube, but an edge of the triangle cut a plane or more of the cube. So ok, let’s test the intersections between each edge of the triangle and each plane of the box. HOWEVER, there is a last case : with a big triangle and a tiny box, the three edge could never intersect the cube, but the plane of the triangle could. So we also have to test the intersection between each edge of the cube and the plane of the triangle.
Lots of test just for saying there is no collision. It would be more efficient if the “no collision” case can be prove with few tests. A way to work on it could be the SAT : Separating Axis Theorem. On projecting the two objects on an axis, and looking if there is no gap between their “shadow”, we can determine the intersection. More explaination here :

http://www.codezealot.org/archives/55SAT Theorem

We will try to implement this method.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s