# I want to find the polygons of two overlapping polygons [closed]

I have two polygons. One small one big.

Is there a formula that gives the polygon of the where the two polygons overlap? I want to paint this area so I need to calculate it.

I'm using Objective-C so have two arrays contains the points of the polygon.

Many Thanks, -C

## closed as off-topic by Sahiba Arora, Claude Leibovici, Gautam Shenoy, Joel Reyes Noche, user223391 Jan 26 '18 at 19:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Sahiba Arora, Claude Leibovici, Community
If this question can be reworded to fit the rules in the help center, please edit the question.

• Please give examples. – David G. Stork Jan 23 '18 at 18:08
• Are both polygons convex? This is an important detail. By the way, you're looking for an intersection algorithm. This might be useful, it just showed up when I looked for objective c polygon intersection: github.com/SunGard-Labs/MKPolygon-GPC – Larry B. Jan 23 '18 at 18:09
• This is generally known as polygon intersection or polygon clipping. If you know that one of your polygons is convex then it becomes a little easier, but in general this can be very hard - two non-convex polygons with $n$ vertices can have up to $O(n^2)$ different polygons in the intersection. Have a look at Wikipedia's page on Weiler-Atherton clipping ; that should point you to more resources. – Steven Stadnicki Jan 23 '18 at 18:11
• I'm voting to close this question as off-topic because it appears to be requesting an algorithm. It would be better served in cs.stackexchange – Gautam Shenoy Jan 24 '18 at 12:54
• This is a well-studied problem. Perhaps start with this question and its answers: How do I combine complex polygons?. – Joseph O'Rourke Jan 24 '18 at 16:59