mathcollisionbounding

Checking if any of corners of a rectangle is inside other rectangle


I'm having a mathematical issue.

I have no issue checking if one rectangle is within bounds of the other when they both (or one of them) have no angle and fit the grid perfectly.. but once I change angle of both of them, it all goes downhill.

Here's what I mean - the one to the right works flawlessly, but the ones to the left not so much: enter image description here


Solution

  • enter image description here

    P = aA + bB

    Solve for a and b. P is inside the rect, if a < 1 && b < 1