ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1616. Square Country 4

What is the most simple way...
Posted by DK [Samara SAU 1: X2008] 21 Apr 2008 01:44
What is the most simple way to find an area of two squares' intersection?
Re: What is the most simple way...
Posted by Denis Koshman 22 Aug 2008 17:41
Find it as intersection of two arbitrary convex polygons, otherwise you'll bury yourself in special cases.

To do so get all points of one polygon inside the other, all points of the other polygon inside the first one, and also all their intersections by non-parallel sides.

Then find area of their convex hull. Angle/distance sorting step is enough to find that hull.