# Is there a name for this algorithm for 2d shape collision?

A while ago I was considering my possibilities for implementing collisions between 2D shapes, and after much googling (which mostly turned up SAT), I came up with this:

let A, B = two shapes
let V = Speed of A relative to B

for a:point in vertices of A
for b:segment in segments of B
if segment(a, a+V) intersects b
return intersection point
return false


Now, I'm far from the smartest person out there, so I am 99.8% sure someone must have come up with that before me and, what's more important, since I didn't find anything describing this method, I assume it's a bad one.

Can anybody identify this algorithm and/or point me towards any literature on it explaining if, when and why it should be used?

I've failed to see any significant problems at first sight; all the complex calculations can be hoisted outside of the loops and then it's just matrix multiplications within both loops, and I couldn't find any algorithm that makes do without any nested loops over two sets of elements (be they vertices, segments or normals)

Feel free to trash-talk my algo all you like, I never expected it to be the second greatest discovery right after general relativity or anything ;)

PS: Sorry for the poor title, but I can hardly explain the entire algo in one line :)

• This algorithm will return false if A is completely within B or vice versa, by the way. – Philipp Jul 9 '19 at 16:55
• @Philipp of course, thanks for pointing that out, but for B to get inside A it must have collided at some point, so for me that's acceptable. It also allows for a shape to be "trapped" within another, like a bottle, for example. – DarkWiiPlayer Jul 9 '19 at 16:56
• You might like to search for "swept" or "continuous" collision detection. – Jay Jul 14 '19 at 6:33