Finding A connecting region between two unconnected hulls

2 views (last 30 days)
Hi, I have many convex hulls in 2D that represent different shapes. The hulls are not connected or overlapping, but some sides of them are very close to other hulls. I want to write something that can determine whether a part of the hull is close enough to another hull, and merge the two parts of that polygon so they're connecting, but maintain two separate polygons. Attached is an image of an example where there are two hulls next to each other. The goal would be that the place where they're very close I could have them share points in that area between them.
The hulls also can be somewhat odd-shaped, and the area where they're close may have several points in one hull, and not many in the other, so essentially you'd have many lines from one polygon and just one from the other, but the goal would still be to share that area. Thanks!
  1 Comment
Anuruddha Jayasuriya
Anuruddha Jayasuriya on 31 Dec 2017
Hi Cole Smith,
Are those hulls in 2D generated randomly? Or otherwise, how did you make sure that the hulls (many of them) didn't overlap with each other?
Thank you.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 6 Jun 2015
What do you have? Images or just coordinates? If you have coordinates, use poly2mask() to turn them into an image. Then, once you have an image, use imclose() to do a mrophological closing operation to join the two regions. The use bwboundaries() to get the outlines. If you want only the convex hull coordinates, then pass the results of bwboundaries() into convhull(). imclose might change the shape of non-smooth parts of the boundary slightly but it looks like you shouldn't have anything to worry about with the shapes you gave.
Another option is to use activecontour(). A demo is attached.
  8 Comments
Cole Smith
Cole Smith on 6 Jun 2015
Or perhaps on more thought on this...if I find a series of points in polygon A and a series in polygon B that are all within some small distance of the other polygon, I could do a voronoi diagram on just those points and pick out the part of the voronoi that runs through them.
Image Analyst
Image Analyst on 7 Jun 2015
I don't see how voronoi would help since you want to retain most the sides completely unaltered. The algorithm is simple enough, but rare enough that there is no built in function for it. You can easily write your own. Let us know if you can't.

Sign in to comment.

Categories

Find more on Voronoi Diagram in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!