Finding the shape created by two other intersecting shapes
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.
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.
精彩评论