jeffThompson / CollisionDetection

A book and examples on collision detection
418 stars 53 forks source link

Collision for parallel line to line #14

Open getdbjs opened 4 years ago

getdbjs commented 4 years ago

I noticed that the collision is not detected between two parallel lines

Lin-Rolover commented 4 years ago

Since the parallel never intersects, because the slope of each is infinity or zero, the other question is when are perpendicular, when the angular coefficient of one of them is infinity.

Yes, and the formula is hard to understand

jeffThompson commented 4 years ago

@getdbjs – nope, you're right. I assumed that was a really unlikely case (since the lines would have to have the exact same start/end points for that to be the case which, with floats, is not going to happen very often) but can def add it.

@Lin-Rolover – thanks for clarifying. Would parallel and perpendicular be useful to add? (I suppose perpendicular is really just one kind of collision.)