Finding a shape created by two other intersecting shapes

I have two overlapping shapes in my C # application defined by arrays Point. I need to find the points that define the shape where the two overlap. In this image, I know the red and green dots, but I need the yellow dots.

alt text

Here is some dummy code that might help:

Point[] GetIntersection(Point[] red, Point[] green)
{
    Point[] yellow = ?!?;

    return yellow;
}

Of course, you can do this by accepting nice simple rectangles. In practice, I need to be able to handle polygons and possibly even circles (although I can live without circles).

Any ideas? I hope there is a great GDI + feature that just spits it out.

+3
source share
1 answer
+5

Source: https://habr.com/ru/post/1770174/


All Articles