开发者

Finding the shape created by two other intersecting shapes

开发者 https://www.devze.com 2023-01-20 06:20 出处:网络
I have two overlapping shapes in my C# app, defined by Point arrays. I need to find the points that define the shape where these two overlap. In this image, I know the red and green points, but I need

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

Finding the shape created by two other intersecting shapes

开发者_开发知识库

Here is some dummy code that might help:

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

    return yellow;
}

There are certainly ways you could do this assuming nice easy rectangles. In practice, I need to be able to handle polygons and maybe even circles (although I can live without circles).

Any ideas? I'm hoping there is a nifty GDI+ function that will just spit this out.


It sounds like the Region::Intersect method does what you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号