Jump to content

Check if 2d polygon has "loops" inside


Recommended Posts


I'm trying to make an envelope around a shape that is not convex. When envelope width is too big, the shape that is created contains "loops", like that red one:

The problem is that I want to use Point In Polygon.vi to remove all outliers and artifacts out of the envelope, but this vi will give me incorrect result inside those "loops" (points are marked Outside of polygon instead of Inside)

Is there some smart way of finding and removing those "loops"?

I can use all the functions from vision library if needed.



Link to comment

Check to see if any line intersects with any other.  For N line segments, this requires (N-1)! comparisons.  Easiest way to do it.

Once you know which lines intersect, you can remove the in-between lines and move the start / end point of the two directly affected lines to the intersection point.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.