For a collision check I need to calculate time when two convex polyhedra intersect if one of them is moving along a straight line. Currently, I have:
A
and its movement direction.B
C
, |C| = |A| * |B|
C
(using QuickHull)This all works, but is slow. Especially the step to calculate the triangulated convex hull.
I wonder if there is a faster way to calculate the ray-convex polyhedron intersection from the set of points without calculating the triangulated convex hull. I could get the input as planes (plane equations) if it helps.
Solved by separation axis theorem:
shift
along the movement direction when each plane becomes a separation plane (vertices of the other collision volume are all in front of the plane).shift
when there is no separation plane. This can be done in place by keeping track of minimum and maximum values encountered.Compared to the original solution:
O(N log N)
to O(N)
, where N = |C| = |A| * |B|