Answers for "Check if two rectangles overlap"

0

Check if two rectangles overlap

if (RectA.Left < RectB.Right && RectA.Right > RectB.Left &&
     RectA.Top > RectB.Bottom && RectA.Bottom < RectB.Top )
Posted by: Guest on August-12-2021
1

check if two rectangles overlap javascript canvas

// Where left, right, top and bottom are essentially edges

if (a.left >= b.right || a.top >= b.bottom || 
    a.right <= b.left || a.bottom <= b.top)
{
    // no overlap
}
else
{
    // overlap
}
Posted by: Guest on July-24-2020

Code answers related to "Check if two rectangles overlap"

Browse Popular Code Answers by Language