I have 2 rectangles in a 2D plane, only in the first quadrant with limit 2000 x 2000:
A (black) & B (red)
Look at the attached image
Both can change positions (coordinates, X & Y).
B has fixed dimensions (width & height), always known.
A's dimension can change, but they are always known.
I will always know the top and left coordinates of A & B (which can keep on changing) and can shift the rectangles to other quadrant.
Kindly look at the images below:
How do I determine whether more than 50% area of the red rectangle (B) is inside the black rectangle (A)?
I understand that (area of B intersected by A) divided by Area of A should be > 0.5. How do I take care of the coordinate system within 2000, 2000, and cases where A might be too small to fit B?