Variant 4.13.2 (new C++ edition): Non xy aligned intersecting rectangles?

#1

Hi All,

Can someone please share the codes for problem 4.13.2 which goes as follow: “How would you check if two rectangles, not necessarily aligned with the x and y axis, intersect” ? I am having some issues with it.

I also would like to find the coordinate of the intersecting rectangle. Can someone help with that?

If nobody has code for the request above, let’s have an in depth discussion. I would like to solve this problem.

Thanks!
Joan

0 Likes

#2

Hi @joc,

Let me start giving an idea, you can check https://en.wikipedia.org/wiki/Point_in_polygon for the idea of this. For rectangle, I am not sure is there any other easier approach but this is a good one to solve this problem.

0 Likes