Dana Vrajitoru
B583/C490 Game Programming and Design

Collision Detection

Collision Detection

Collision Meshes

Coplanar Polygons Intersection

Polygons Intersections
Both polygons have vertices inside the other Only one polygon has a vertex inside the other
No edge crossing No vertex is inside any of the polygons

Inside a Polygon

Edges Intersection

Equations of the two lines:
(Px - Ax)/(Bx - Ax) = (Py - Ay)/(By - Ay)
(Px - Cx)/(Dx - Cx) = (Py - Cy)/(Dy - Cy)
By solving these we find P.

P must be between A and B and between C and D on the lines:
(Px - Ax)(Px - Bx) < 0
(Px - Cx)(Px - Dx) < 0
Only one coordinate needs to be checked because the points are colinear.

Both the vertex check and the edge check are O(n2), where n is the number of vertices in the highest polygon.

Two-Phase Algorithms

Swept Volume for a Moving Object

From B. Mirtich (1997): Efficient Algorithms for Two-Phase Collision Detection, Technical Report TR-97-23, Mitsubishi Electric Information Technology Center America.

Coordinate Sorting

A hash table can be used to improve the sorting.

Narrow Phase Collision

Lin-Canny Algorithm

Voronoi Regions

Lin-Canny Algorithm

Other Algorithms

3D Intersections

Movement through a Polygon

Crossing a Polygon

Non-Coplanar Polygons

Box - Sphere

Moving Past a Sphere

Motion and Collision

Imperfect Bouncing