Is there a function to see if a polygon is contained within another polygon?

asked 2016-01-13 14:54:22 -0600

I need to test to see if a polygon is contained within another polygon. Right now I'm just iterating through the points in one polygon and calling pointPolygonTest() on each one. I'm wondering if there is an openCV function to do this in a single call.

edit retag flag offensive close merge delete


There doesn't appear to be such a thing. As long as you're using convex polygons, your method should work.

If they're more complicated, you need to check that there is at least one corner inside, and that the edges of the inner polygon never intersect the outer one.

Tetragramm gravatar imageTetragramm ( 2016-01-13 18:10:31 -0600 )edit

Thanks. I'm only working with convex polygons so I guess I'm good.

SSteve gravatar imageSSteve ( 2016-01-14 17:37:45 -0600 )edit