Find if two rectangles overlap | GeeksforGeeks

preview_player
Показать описание


This video is contributed by Sagar Khurana

Please Like, Comment and Share the Video among your friends.

Also, Subscribe if you haven't already! :)
Рекомендации по теме
Комментарии
Автор

the variable names should change to ul and lr denoting upper left and lower right.
ul1.x > lr2.x (upper left x is greater than lower right x. can visualize rectangle 1 is on right side of rectangle 2. )

spicytuna
Автор

What is X and y? Please explain the comparison of both rectangles with X and Y? Is X and Y the distance between two rectangles or position on the graph

tencups
Автор

Thankyou for the explanation. Understanding simply by looking at the code was difficult. But ig there was 1 more condition that was given in the code that I didn't find in your explanation which checked whether the rectangles were lines.

VaibhaviLohaniBCE
Автор

From some reason I couldn't find this simple algorithm. You saved me a lot of work and nerves. Thanks a lot!!

vizourcz
Автор

got a question. Is it applicable in n dimensions? Great content by the way.

caminantesombrio
Автор

if we enter cordinates Point l1 = {20, 20}, r1 = {30, 30};
Point l2 = {10, 10}, r2 = {40, 40}; the program returns does not overlap but in actually it overlaps

SubinBabukuttan
Автор

is it possible to do the same thing in matlab without overlapping, by allocating 10differnt rectangles items in a single big box

sridharmotapothula
Автор

What about the condition if one rectangle is inside the other rectangle??

sarcazamk
Автор

What if we have n zones and we wish to find the number of zones that each rectangle overlaps?

sebhacks
Автор

This help me to complete my homework. Thanks in advance!

ahmetburakbarakl
Автор

if l1 = l2 and r1 = r2, the rectangle should be perfectly overlapped but this algorithm says it's not.

vikramsandu